SyntaxError: multiple statements found while compiling a single statement

Rustom Mody rustompmody at gmail.com
Sat Oct 8 07:05:53 EDT 2016


On Saturday, October 8, 2016 at 1:21:50 PM UTC+5:30, Cai Gengyang wrote:
> This is the result when I copy and paste it one line at a time :
> 
> >>> rect_x = 50
> >>> rect_y = 50
> >>> while not done:									
>  for event in ...
<etc>

There's sure something strange about your formatting

you want something like this I think:

rect_x = 50
rect_y = 50
while not done:
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            done = True

On a related note in addition to Steven's 2 suggestions
- paste 1 line at a time
- Write the code in a py file

you could also try it out without Idle
ie start python at your shell (or terminal or cmd.exe or whatever)
And try it there



More information about the Python-list mailing list