[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[pygame] Re: interactively pygame



I would like to know, how to interactively play with pygame in Python
command line.
After import pygame and pygame.init() and pygame.display.set_mode(xxx)
appears the output window. After typing other commands, this windows is
still inactive, not being able to bring it to front.
I cant see what it happened there. I can see iconizied button of this
window, but
without any chance to see its content.

It sounds like the problem is that you need to call: pygame.display.update() (or pygame.display.flip(), I think, if you're using double buffering) to make what you've drawn visible. Unless you're running that command frequently, as in a loop, the Pygame window will act broken. (I think .update() also runs the event-handling code.) But you can still update it manually.



When I made an interactive pygame script for pygsear
(http://www.nongnu.org/pygsear/) I found that windows was
really not good for this kind of setup.

On linux and bsd I can set the window manager to focus follows
mouse and to not raise on click, so I can type in to a window in
the background, but windows likes to always have the active
window on top. Anyhow...  I ended up putting the interactive
prompt inside of the pygame window.

Look for the script in the pygsear examples called interact.py

The other thing I did was to start a separate thread that called
pygame.display.update() once every second. It has been a while
so I don't really remember if that was working very well or not.

The thread code does not seem to be used by interact.py so
there may have been issues. The thread code is in penguin.py

_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/