Search code examples
pythonpython-3.xpygleti3

How to set type attribute for window in Pyglet?


I just started learning Pyglet but hit a roadblock. I am using the i3 window manager, and when I open a window with Pyglet, it floats. My guess is that i3 treats it like a dialog and positions it in the center of my screen. I tried setting the style attribute of the Window object to to all possible values, but it had no effect. How can I set the type attribute of the window to DEFAULT so that the window is part of the i3 grid and not floating in the center?

I read on StackOverflow how to make a floating window with Tkinter and Cairo GTK(thinking that doing the opposite will give me a non-floating window), but I can't find a way to set the window type attribute in Pyglet the way it can be done with other libraries.


Solution

  • I figured it out by looking for the same issue with SDL. Apparently, the type hint is not needed if the window is specified as a resizable. By adding resizable=True to the window constructor arguments, the window is included as a part of the grid.

    If the intended behavior is to have a floating window(ex. a game or dialog) set resizable=False. Else resizable=True.