2 Replies - 756 Views - Last Post: 19 August 2008 - 09:08 AM Rate Topic: -----

#1 yanom  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 70
  • Joined: 05-April 08

Ok, now this is just weird.

Posted 19 August 2008 - 08:52 AM

Ok, here is my python program:

import pygame, os, sys
from pygame.locals import *
pygame.init()
screen = pygame.display.set_mode((400, 400), 0, 32)
while True:
	for event in pygame.event.get():
		if event.type == QUIT:
			exit()
	pygame.display.update()


and here is what happens when i run it (I am using Ubuntu on my brand-new intel quad-core computer)
yanom@yanom-desktop:~$ cd app
yanom@yanom-desktop:~/app$ python test.py
  File "test.py", line 6
	while True:
		^
SyntaxError: invalid syntax
yanom@yanom-desktop:~/app$


can someone please tell me why "while True:" is invalid syntax?

Is This A Good Question/Topic? 0
  • +

Replies To: Ok, now this is just weird.

#2 Stutzbach  Icon User is offline

  • New D.I.C Head

Reputation: 6
  • View blog
  • Posts: 29
  • Joined: 06-July 08

Re: Ok, now this is just weird.

Posted 19 August 2008 - 08:58 AM

View Postyanom, on 19 Aug, 2008 - 09:52 AM, said:

can someone please tell me why "while True:" is invalid syntax?


"while True:" is valid. I can't see anything wrong with your program. I don't have pygame installed so I can't test the whole thing. Maybe you could try commenting out different lines to isolate the problem?
Was This Post Helpful? 0
  • +
  • -

#3 MitkOK  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 32
  • View blog
  • Posts: 403
  • Joined: 09-August 07

Re: Ok, now this is just weird.

Posted 19 August 2008 - 09:08 AM

This code works on Ubuntu, most probably your indentation is not appropriate.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1