[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[pygame] Windows problems with event.wait() and display.set_mode()
- To: pygame-users@xxxxxxxx
- Subject: [pygame] Windows problems with event.wait() and display.set_mode()
- From: Tobias Pfeiffer <BoteDesSchattens@xxxxxx>
- Date: Sun, 13 Feb 2005 01:29:48 +0100
- Delivered-to: archiver@seul.org
- Delivered-to: pygame-users-outgoing@seul.org
- Delivered-to: pygame-users@seul.org
- Delivery-date: Sat, 12 Feb 2005 19:31:06 -0500
- Reply-to: pygame-users@xxxxxxxx
- Sender: owner-pygame-users@xxxxxxxx
- User-agent: Mozilla Thunderbird 0.9 (X11/20041124)
Hi!
I am writing a network multiplayer game that is supposed to run on Linux
and Windows (see http://running-robots.sourceforge.net if you are
interested to get to know more). In Linux, it works quite fine, but on
Windows there are essential problems and I just don't know why...
At first I open a window that I call splash screen and this provides a
method "get_data" to query a user for some data. If this method is
called, there are text fields drawn (there is an class of its own for
this text field) into the window and then a "while 1" loop waits for
KEYDOWN events to forward them to a text field.
I call this method twice: the first time to prompt for the address of
the server to be connected to and the second time to prompt for the nick
name of the user. Now on Linux this works fine, while on Windows, only
the first time works. When I call get_data the second time, there are
simply no events received from the window. The relevant lines are:
pygame.event.pump()
while 1:
print "I'm alive"
ev = pygame.event.wait()
print ev
(The whole source is available through CVS from the above address.)
So when I ask for the server data, everything works, even on Windows.
Then I call "get_data" again, but the window does not react to key
presses any more. In the above code snippet, only "I'm alive" would be
printed but nothing else. If I take away the window's focus and refocus
it, there is only the big hourglass cursor, the window's background
isn't drawn correctly and after a certain time, I am informed about the
window not reacting any more. Changing in the console window and
pressing Ctrl+C shows me that it was the event.wait() call that was
interrupted. So I ask myself why Windows does not forward the events to
the current window. Well, I suppose this is related to my next problem,
which is somewhat similar, so I think there are similar reasons.
I can also give the nick name as a command line, so then this prompt is
skipped. But however, after that, the window is resized to a larger
size. On Linux, once again, this works fine, while on Windows, the
script hangs exactly in the line
pygame.display.set_mode(dims)
I mean, there is no error message, there just happens nothing. I suppose
this is because somehow pygame cannot access the window because Windows
does something odd with it, but I have no idea what. I thought that
maybe it would be good to close the window and reinitialize
pygame.display before I resize it. Unfortunately, this leads to really
unwanted effects, namely the window being exactly as large (but with the
expected content, just truncated) as before and not reacting to input
either.
Well, I could simply try to describe what other odd things happen if I
delete the pygame.display.init() line or move it to somewhere else, but
maybe someone of you already knows this problem and can tell me what
Windows does with what it pretends to handle best (the window, of course
*grin*).
Thanks for your help!
Bye
Tobias
--
follow the penguin...
Attachment:
signature.asc
Description: OpenPGP digital signature