Pygame, how to show window without loop? no loop=popupand close...

Nick Dumas drakonik at gmail.com
Fri Jun 27 22:35:48 EDT 2008


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

defn noob wrote:
> Im using PyGame to draw images of graphs and trees. Howver right now i
> am looping using:
> 
> while 1:
>     for event in pygame.event.get():
>         if event.type == pygame.QUIT: sys.exit()
> 
>     screen.fill(screencolor)
> 
>     pygame.draw.circle(screen, linecolor, (500, 20), 12, 0)
> 
>     draw((500, 20), 3)
> 
>     pygame.display.flip()
> 
> 
> if i do
> 
> screen.fill(screencolor)
> 
> pygame.draw.circle(screen, linecolor, (500, 20), 12, 0)
> 
> draw((500, 20), 3)
> 
> pygame.display.flip()
> 
> it just pops up and closes. how can i make it stay until i close it
> without using a loop?
You need the loop, because without it, the script would reach the
end-of-file and stop executing.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkhlo4QACgkQLMI5fndAv9izMwCeKVOyPh74vUZwau+Qsnns6NeY
PP0An03w+GQQ2neR7Gh779uJcqN56Cpd
=nlGj
-----END PGP SIGNATURE-----



More information about the Python-list mailing list