[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
RE: [pygame] Starting from IDLE
> When I run a pygame program from IDLE (windows IDE) the game window
> doesn't close when the application stops.
> I have to press CTRL-ALT-DEL to close the window. Am I missing
something ?
>
> Bo)
I don't know why this happens to you...
This is an example of a small program which will run in IDLE, SciTE (a
much better editor than IDLE: http://www.scintilla.org/) and whatnot and
when I hit escape or click on the upper right 'X' the window will close
and everything returns back to 'normal'.
###############################
def main(winstyle = 0):
running = 1
while running:
#get input
for event in pygame.event.get():
if event.type == QUIT or \
(event.type == KEYDOWN and event.key == K_ESCAPE):
# jumping out of main loop
return
if __name__ == '__main__':
main()
pygame.quit()
###############################
It's this what you are trying to do?
Regards
Erlend Stromsvik