Skip to content

Window not shown unless get_surface is called. #139

@backwardspy

Description

@backwardspy

I've put together a minimal example of opening a window with PySDL2. I'm not sure what I'm missing, but my window only shows up if I include a call to window.get_surface() (even if I throw away the result.)

Here's my (working) example:

import sys
import sdl2
import sdl2.ext


def main():
    sdl2.ext.init()
    window = sdl2.ext.Window("PySDL2 Test", size=(320, 200))
    window.show()

    window.get_surface()

    sdl2.ext.TestEventProcessor().run(window)

    sdl2.ext.quit()
    return 0


if __name__ == "__main__":
    sys.exit(main())

If I comment out line 11 (window.get_surface()) then the window is never shown. None of the examples seem to do this, so I feel like I'm missing something.

If it makes any difference, I'm using SwayWM on Wayland.

Thanks!

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions