Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

[open] pygame within Psychopy backend

edited October 2014 in OpenSesame

Is it possible to call a function from pygame when the experiment runs with the Psychopy backend?

I use Psychopy for its ability to stick to the refresh rate, but the keyboard input does not recognize accented letters. So I wrote a script that should handle keyboard events using pygame. This script gives the expected results when the Legacy backend is on, but the for loop is not active when the Psychopy backend is selected.

The script is:

import pygame
pygame.init()
cpt = 1
while cpt<100:
    for event in pygame.event.game()
        print event
    self.sleep(20)
    cpt = cpt + 1
pygame.quit()

Comments

  • edited October 2014

    It's perfectly possible to mix and match different back-ends, even without using code. Do this by going to your experiment script (click on the top item in the overview, then click the Script Editor button). The start of your script will look like the following:

    # Generated by OpenSesame 2.8.3 (Gutsy Gibson)
    # Wed Oct 15 15:34:08 2014 (posix)
    # <http://www.cogsci.nl/opensesame>
    
    set mouse_backend "psycho"
    set subject_parity "even"
    set height "768"
    set font_italic "no"
    set canvas_backend "psycho"
    set synth_backend "legacy"
    set start "experiment"
    set title "New experiment"
    set coordinates "relative"
    set width "1024"
    set sampler_backend "legacy"
    set transparent_variables "no"
    set foreground "white"
    set font_bold "no"
    set description "Default description"
    set background "black"
    set font_size "18"
    set keyboard_backend "psycho"
    set font_family "mono"
    set compensation "0"
    set bidi "no"
    set subject_nr "0"
    

    If you want to use the PyGame back-end for the keyboard, change it to:

    # Generated by OpenSesame 2.8.3 (Gutsy Gibson)
    # Wed Oct 15 15:34:08 2014 (posix)
    # <http://www.cogsci.nl/opensesame>
    
    set mouse_backend "psycho"
    set subject_parity "even"
    set height "768"
    set font_italic "no"
    set canvas_backend "psycho"
    set synth_backend "legacy"
    set start "experiment"
    set title "New experiment"
    set coordinates "relative"
    set width "1024"
    set sampler_backend "legacy"
    set transparent_variables "no"
    set foreground "white"
    set font_bold "no"
    set description "Default description"
    set background "black"
    set font_size "18"
    # HERE IS THE KEYBOARD BACKEND (delete this line, it's for illustrative purposes only)
    set keyboard_backend "legacy"
    set font_family "mono"
    set compensation "0"
    set bidi "no"
    set subject_nr "0"
    
  • edited 10:45AM

    I use Psychopy for its ability to stick to the refresh rate, but the keyboard input does not recognize accented letters.

    If all you want is a blocking flip, you can also use the xpyriment back-end. This is built on pygame, so you could use pygame functions without any hacks. I'm not sure what will happen if you switch only the keyboard back-end to legacy, as @edwin suggests. But I suspect it won't work (?), because pygame doesn't own the psychopy window.

  • edited 10:45AM

    That's a very good question, I hadn't actually tried. Simply assumed this would work :p

Sign In or Register to comment.

agen judi bola , sportbook, casino, togel, number game, singapore, tangkas, basket, slot, poker, dominoqq, agen bola. Semua permainan bisa dimainkan hanya dengan 1 ID. minimal deposit 50.000 ,- bonus cashback hingga 10% , diskon togel hingga 66% bisa bermain di android dan IOS kapanpun dan dimana pun. poker , bandarq , aduq, domino qq , dominobet. Semua permainan bisa dimainkan hanya dengan 1 ID. minimal deposit 10.000 ,- bonus turnover 0.5% dan bonus referral 20%. Bonus - bonus yang dihadirkan bisa terbilang cukup tinggi dan memuaskan, anda hanya perlu memasang pada situs yang memberikan bursa pasaran terbaik yaitu http://45.77.173.118/ Bola168. Situs penyedia segala jenis permainan poker online kini semakin banyak ditemukan di Internet, salah satunya TahunQQ merupakan situs Agen Judi Domino66 Dan BandarQ Terpercaya yang mampu memberikan banyak provit bagi bettornya. Permainan Yang Di Sediakan Dewi365 Juga sangat banyak Dan menarik dan Peluang untuk memenangkan Taruhan Judi online ini juga sangat mudah . Mainkan Segera Taruhan Sportbook anda bersama Agen Judi Bola Bersama Dewi365 Kemenangan Anda Berapa pun akan Terbayarkan. Tersedia 9 macam permainan seru yang bisa kamu mainkan hanya di dalam 1 ID saja. Permainan seru yang tersedia seperti Poker, Domino QQ Dan juga BandarQ Online. Semuanya tersedia lengkap hanya di ABGQQ. Situs ABGQQ sangat mudah dimenangkan, kamu juga akan mendapatkan mega bonus dan setiap pemain berhak mendapatkan cashback mingguan. ABGQQ juga telah diakui sebagai Bandar Domino Online yang menjamin sistem FAIR PLAY disetiap permainan yang bisa dimainkan dengan deposit minimal hanya Rp.25.000. DEWI365 adalah Bandar Judi Bola Terpercaya & resmi dan terpercaya di indonesia. Situs judi bola ini menyediakan fasilitas bagi anda untuk dapat bermain memainkan permainan judi bola. Didalam situs ini memiliki berbagai permainan taruhan bola terlengkap seperti Sbobet, yang membuat DEWI365 menjadi situs judi bola terbaik dan terpercaya di Indonesia. Tentunya sebagai situs yang bertugas sebagai Bandar Poker Online pastinya akan berusaha untuk menjaga semua informasi dan keamanan yang terdapat di POKERQQ13. Kotakqq adalah situs Judi Poker Online Terpercayayang menyediakan 9 jenis permainan sakong online, dominoqq, domino99, bandarq, bandar ceme, aduq, poker online, bandar poker, balak66, perang baccarat, dan capsa susun. Dengan minimal deposit withdraw 15.000 Anda sudah bisa memainkan semua permaina pkv games di situs kami. Jackpot besar,Win rate tinggi, Fair play, PKV Games