[PyOpenGL] multiple screens and Tkinter/Togl
Rene Liebscher
R.Liebscher at gmx.de
Thu Aug 30 03:56:48 EDT 2001
Michel Sanner wrote:
>
> Hello,
>
> I have 2 screens on my unix box and I can use the screenName argument to get a
> Tkinter.Tk instance to appear on either screen. But when I try to create an togl
> Widget I get an Xserver error that kills my python interpreter. Here is the code
> creating the problem
>
> import Tkinter
> r1 = Tkinter.Tk(screenName=":0.0")
> r1.tk.call('package', 'require', 'Togl')
> r2 = Tkinter.Tk(screenName=":0.1")
> r2.tk.call('package', 'require', 'Togl')
> f1 = Tkinter.Frame(r1)
> f2 = Tkinter.Frame(r2)
> f1.pack()
> f2.pack()
>
> class OGL(Tkinter.Widget):
> def __init__(self, master, ident):
> cnf = ()
> kw = {'double':1} #, 'depth':1, 'accum':1, 'ident':ident}
> Tkinter.Widget.__init__(self, master, 'togl', cnf, kw )
>
> o1 = OGL(f1, '1')
> o2 = OGL(f2, '2')
>
> X Error of failed request: BadMatch (invalid parameter attributes)
> Major opcode of failed request: 1 (X_CreateWindow)
> Serial number of failed request: 149
> Current serial number in output stream: 151
>
> My 2 screens have different resolution and depth but it does not seem to be a
> problem for regulat Tk widgets.
>
> I am also wondering if the fact the screenName is an argument to Tk means that a
> Tkinter application cannot have windows on 2 screens at the same time (unless
> they do not share the same interpreter).
>
> Any Ideas or comments would be very welcome
>
> -Michel
>
This might be a problem in Togl.
I don't know enough about X to find the problem, but
I found the following.
In togl.c there are some uses of the DefaultScreen macro.
For this macro I found these description:
-----------------------------------------------
DefaultScreen
DefaultScreen(display)
int XDefaultScreen(display)
Display *display;
display Specifies the connection to the X server.
Both return the default screen number referenced by the XOpenDisplay()
function.
This macro or function should be used to retrieve the screen number in
applications
that will use only a single screen.
-----------------------------------------------
You see that "in applications that will use only a single screen."
It might help to change this.
(See also
http://sourceforge.net/tracker/index.php?func=detail&aid=222132&group_id=519&atid=100519
there is also a description of a problem with DefaultScreen,
They recommend to use Tk_ScreenNumber(togl->TkWin) )
The XCreateWindow function has no parameter screen,
but the call of glXChooseVisual has. Using a wrong screen parameter
here might lead to a wrong visual which makes XCreateWindow
to complain about it.
I don't know if any of these hints help, but if it works we
should put it in the CVS.
Kind regards
Rene
More information about the Python-list
mailing list