[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [pygame] interactive pygame?



R. Alan Monroe wrote:
When I open a pygame window from an interactive python session, I
can't move, size, minimize or maximize the pygame display. And if I
bring another window to the front, pygame's window can't be reached or
brought frontmost again. Any workarounds for this? I'm on win32.
you can create a resizeable window by passing the "RESIZABLE" flag to display.set_mode(). this will take care of the size and maximize issues.

your other problem is with moving, raising, and minimizing. the problem is these happen in the same thread as the interactive python. so while the prompt is sitting there, pygame can't do anything with the window. all the actions you have taken are sitting inside the system event queue, but pygame/SDL need a chance to go receive those events and process them.

calling pygame.event.pump() will tell pygame and SDL to handle the windows events. you could also call any of the other pygame.event functions which effect the pygame event queue.

the pump() function will return pretty quick, but any window interactions you have made will all happen very quick. you will have to call pump() anytime you do something to the window for it to react.