Hi,

I have the same problem running pygame programs from the interpreter. I now
just put a shebang line on top of the script like

#!/usr/bin/env python

and do chmod +x on the script and then run it from the terminal by doing
./script.py or double clicking on the file. It works fine when run directly
instead of from the interpreter.

Regards,
Ali

On Sat, Aug 1, 2009 at 8:03 PM, David <ld...@gmx.net> wrote:

> Dear Tutors,
>
> I have written a simple pygame program:
>
> <code>
> import pygame, sys
> pygame.init()
> screen = pygame.display.set_mode([640, 480])
> screen.fill([255,255,255,255])
> pygame.draw.circle(screen, [0,255,0], [150,200,], 30, 0)
> my_rect = (250, 150, 300, 200)
> pygame.draw.rect(screen, [0,0,255], my_rect, 0)
> pygame.display.flip()
> while True:
>    for event in pygame.event.get():
>        if event.type == pygame.QUIT:
>            sys.exit()
> </code>
>
> I am using Ubuntu Jaunty, Python 2.6.2:
>
> When I try to quit the program (clicking on the windows' [X] button),
> nothing happens.
> When I press CTRL-C on the Python interpreter, triggering a
> KeyboardInterrupt, the windows' content vanishes (turns black), but the
> window itself remains and can't be killed except by killing the Python
> interpreter from which I started my program.
> What is going on? I obviously want the window to disappear once I hit
> the [X] button!
>
> Cheers for a hint,
>
> David
> _______________________________________________
> Tutor maillist  -  Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
>



-- 
http://alitechtips.blogspot.com/
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to