Howdy, Stranger!

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

Supported by

[open] How to select monitor for displaying experiment?

edited June 2013 in OpenSesame

I want to present my experiment on extra display connected to my laptop. I use xpyriment back-end. How can I choose on what monitor experiment must be presented?

Comments

  • edited 10:32AM

    I don't believe Expyriment offers any control over which monitor is selected in a dual-monitor set-up, although you could ask the Expyriment developers to make sure.

    PsychoPy does offer this functionality, so you could consider switching to the psycho back-end. I believe the way it works is that you define a monitor in the PsychoPy monitor center (you may have to install standalone PsychoPy to get this program). In OpenSesame, you can then select this monitor in the back-end settings.

    I have never done this myself, so the instructions above are approximate. Please post if you have any experiences to share!

    Cheers!
    Sebastiaan

  • edited 10:32AM

    In my opinion dual-monitor set-up is very useful. You can sit at control room and participant in another (silent, shielded) room. And all what you need for this is one another monitor and appropriate cable (VGA or so). Cheap and cheerful :)

    It's can be done with Windows settings.
    1. Run OpenSesme
    2. Double‐click on the Display control panel icon (for Windows XP)
    3. Click the Settings tab
    4. Find the drop down menu and select your second monitor. Below the window, there should be a check box that says, "Extend my Windows desktop onto this monitor" and "Use this device as the primary monitor". Check both.
    5. Apply.

    After it if you run your experiment it will be shown on the second monitor.

  • edited 10:32AM

    Ah, thank you for sharing these instructions! That sounds simple enough.

  • edited 10:32AM

    If I recall correctly, OpenSesame simply uses monitor '0' when creating the PsychoPy Window object (named 'win' within an experiment). Therefore one doesn't have to bother with the monitor center, simply figuring out which monitor is '0' (I believe it normally is the leftmost) should be enough.

  • edited 10:32AM

    @Edwin can you give short example, or another start point for me?

  • edited June 2013

    There's not much to get you started with, I'm afraid :p

    The thing is that in OpenSesame, a PsychoPy Window is created and no value is passed for the keyword argument 'screen', therefore its value defaults to 0. This means the physical screen number you'll use is always '0'. I'm not quite sure whether this is your main monitor, the leftmost monitor or the monitor that contains point (0,0) (or something entirely different). EDIT: it appears to be the monitor that contains point (0,0); it does not seem to matter whether this is your primary monitor (Kubuntu).

    PsychoPy Window: http://www.psychopy.org/api/visual/window.html

    The creation of a PsychoPy Window in OpenSesame: https://github.com/smathot/OpenSesame/blob/master/openexp/_canvas/psycho.py#L409

    EDIT: all right, never mind. I've just checked the statement above and it does NOT apply for all systems. Apparently, on Kubuntu 12.04 the screen argument doesn't do anything. You can test this yourself, by using the following script:

    # run this script using Python, mind you!
    
    # import some stuff we need
    import time
    from psychopy.visual import Window
    from psychopy.visual import TextStim
    
    # loop through possible screens (0 and 1 in this case)
    for scr in range(0,2):
        # create a Window
        win = Window(size=(1280,1024), fullscr=True, monitor="testMonitor", units='pix', winType='pyglet', screen=scr)
        # draw some text on the Window
        TextStim(win, text="This is screen %d" %scr).draw()
        win.flip()
        # wait a bit (so you can see the Window and read the text)
        time.sleep(2)
        # close the Window again
        win.close()
        # wait a bit more before showing the next Window
        time.sleep(2)
    

    I guess your monitor will simply be whatever your default for "testMonitor" is.

    EDIT2: Just checked the PsychoPy documentation (http://www.psychopy.org/api/monitors.html) on the monitors: it appears that you cannot specify which of the physical screens attached to your PC is linked to which psychopy.monitors.Monitor object. Therefore, at least on the system that I am testing this on at the moment, you cannot specify which monitor OpenSesame should use in any other way that making sure that the monitor you want to use contains point (0,0).

    (confused yet? :p)

  • edited 10:32AM

    @Edwin For me (win7) your code is working in PsychoPy shell tab of standalone version.
    So how can I manipulate screen parameter of PsychoPy in OpenSesame?

  • edited June 2013

    So, on Windows 7 you do see the window consecutively appear on two different screens? That's great! In that case, you could try the following:

    Run this in a PsychoPy shell:

    import time
    from psychopy.visual import Window
    from psychopy.visual import TextStim
    
    # create a new Window
    win = Window(size=(1280,1024), fullscr=True, monitor="testMonitor", units='pix', winType='pyglet', screen=0)
    
    # draw some text
    TextStim(win, text="This is screen 0").draw()
    win.flip()
    
    # wait for a bit
    time.sleep(2)
    
    # change the window property of the Window
    win.screen = 1
    
    # draw some text
    TextStim(win, text="This should be screen 1 now").draw()
    win.flip()
    
    # wait a bit more
    time.sleep(2)
    
    # close the Window
    win.close()
    

    If this works, you might implement this in OpenSesame, using an inline_script item placed somewhere at the start of your experiment. In the Run Phase of this inline_script, write the following:

    # set physical screen to screen nr. 1
    win.screen = 1
    

    Make sure your back-end is set to psycho when you try this! In that back-end, 'win' is a PsychoPy Window object. You can change it's screen property just the same as you would do in a regular Python script (as you did using my first two code examples).

    Hope this works for you!

  • edited 10:32AM

    Hi guys,

    Changing the screen attribute will have no effect, because (I assume) it is used only when the window is created. But what you could do in theory is close the window, and open a new one with the desired screen keyword:

    from psychopy.visual import Window
    exp.window.close()  
    exp.window = Window(fullscr=True, units='pix', screen=1)
    

    However, on my system this causes PsychoPy to throw an Exception. But it should work in principle and your mileage on other systems may vary.

    Alternatively, you could get the source file openexp/_canvas/psycho.py and change the initialization of the PsychoPy window (link). Then you can replace the original openexp/_canvas/psychopy.py (or psychopy.pyo) in your OpenSesame installation. Does that make sense? Admittedly, this is a hack, but it shouldn't be too difficult to do.

    I also opened up a feature request for this:

    Cheers!
    Sebastiaan

  • edited 10:32AM

    "hack" method is working nice

  • I know this is an older thread(!), but I just wanted to confirm, for anyone who stumbled across this thread and is still wondering... Expyriment currently does not support multiple monitors, according to the website.

  • edited February 2020

    Thanks sebastiaan, using PsychoPy and editing the psycho.py file worked.

    So for future reference I did the following:

    I went to "C:\Program Files (x86)\OpenSesame\Lib\site-packages\openexp\_canvas" and opened "psycho.py"

    After finding the screen numbers with sebatiaans code, I edited the following parts of the file:


    u"psychopy_screen" : {

    u"name" : u"Screen",

    u"description" : u"The physical screen that is used",

    u"default" : 0,

    },

    And changed the 0 to 1.


    Then further down the following part:

    screen = experiment.var.get(u'psychopy_screen', 0)

    And changed the 0 to 1 as well.

    Then saved the file and that's it.

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