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

Re: [pygame] refresh problem



pistacchio wrote:
Lenard Lindstrom ha scritto:
James Paige wrote:
On Tue, Sep 04, 2007 at 05:09:14PM +0200, pistacchio wrote:
Greg Ewing ha scritto:
pistacchio wrote:
while not done:
   pygame.display.flip()
   for event in pygame.event.get():
       if event.type == QUIT:
           done = True
Note that pygame.event.get() doesn't block, so you're
spinning in an extremely busy loop here. The screen
mightn't be getting a chance to update.

Try putting a pygame.event.wait() call in the loop.

--
Greg

hi there! still nothing.. i've altro tried with pygame's event pump and wait and stuff, and nothing. then, the program worked beautifully without a problem.. till a reboot of the computer, when the same code (now) shows the same problem..

Are you using the IDLE editor? I seem to remember some talk about it causing problems similer to this. There was a command-line option that you had to add to make it run programs in a separate interpreter, which prevented its own event handler from colliding with pygame's

---
James Paige
The IDLE problem isn't really a problem as such. Being an interactive session, the interpreter doesn't shut down when the Pygame code finishes. So pygame.quit is not called and the window remains visible. Restarting the interpreter or adding an explicit pygame.quit() closes the window. As for the OPs example code, I put it in a file and double-clicked. Worked fine.

oh, thanks, this helped a lot. would the situation change with a different ide? any suggestion? (again, i'm working under windows xp)
don't right-click and choose edit with IDLE.
instead, open IDLE from the start menu and load your files from within IDLE (should be in 'recent documents') there's some problem with IDLE and using the separate subprocess that only comes up when you right click and edit, so the developers made it to where if you choose that option from the context menu IDLE boots with subprocess turned off. You can also edit the code for the 'edit with IDLE' menu item to get around this, but this isn't recommended because some people will run into whatever problem there is.
I personally haven't had any problems with re-enabling the subprocess.
-Luke