Question

I am writing a psychophysics experiment using pyglet. The computer I am using has two displays attached to it. They are configured as two separate Xscreens, 0 and 1, corresponding to my workstation monitor and the experiment screen, respectively. I would like to have pyglet draw to the experiment screen (Xscreen 1).

To test the set up I wrote a simple program which displays some text labels. When I run the program with pyglet.window.Window(screen=workstation_screen) the window appears on screen 0 and the text is displayed as expected.

However, when I run the program with pyglet.window.Window(screen=experiment_screen) the window appears on screen 1, but no text appears.

I am very confused by this behavior, am I doing something wrong? is this a known bug in pyglet? is this a problem with X? Any advice would be much appreciated.

Details:

Python 2.7.3 with pyglet 1.1.4 on Ubuntu 10.04.4.

code:

import pyglet

display = pyglet.window.get_platform().get_default_display()
screens = display.get_screens()

# When I replace 'screens[0]' with 'screens[1]' the aforementioned problem occurs.
window = pyglet.window.Window(screen=screens[0])

label = pyglet.text.Label('draw test',x=window.width/2.0,y=window.width/2.0)

@window.event
def on_draw():
    window.clear()
    label.draw()

pyglet.app.run()
Was it helpful?

Solution

I found a work around by enabling Xinerama in Xorg.conf and then calling window.set_fullscreen(fullscreen=True,screen=experiment_screen) to move and fullscreen the window on the second screen only.

However, I am still unsure why the window would appear and not the text without Xinerama enabled.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top