well I'm taking a pygame course at coursehero and well the first program there is to make a window using pygame. Here's the code
Code:
# !/usr/bin/python
import sys, pygame
pygame.init()
size = width,height =800,600
screen = pygame.display.set_mode(size)
image = '/home/nabeel/Desktop/Python/Business_tux.png'
tux =pygame.image.load(image)
x=0
y=0
while 1:
for event in pygame.event.get():
if event.type == pygame.QUIT:sys.exit()
screen.fill((0,0,0))
screen.blit(tux,[x,y])
pygame.display.flip()
x+=1
now this is supposed to draw an empty window and close once I click [x]. But sadly when I run this from terminal i get this error
Code:
nabeel@nabeel-Latitude-D800:~/Desktop/Python$ ./py_game.py
./py_game.py: line 7: syntax error near unexpected token `size'
./py_game.py: line 7: `size = width,height =800,600'
and when I run it from Idle, the window pops up but when I try to close itit doesnot close rather the control is given back to the shell(Window stays present Unless I close IDLE) This problem is present wth both python 2 and 3.