Welcome to Dream.In.Code
Getting Help is Easy!

Join 136,435 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 2,362 people online right now. Registration is fast and FREE... Join Now!




Ok, now this is just weird.

 
Reply to this topicStart new topic

Ok, now this is just weird.

yanom
19 Aug, 2008 - 07:52 AM
Post #1

New D.I.C Head
*

Joined: 5 Apr, 2008
Posts: 46


My Contributions
Ok, here is my python program:

CODE
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)
CODE
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?
User is offlineProfile CardPM
+Quote Post

Stutzbach
RE: Ok, Now This Is Just Weird.
19 Aug, 2008 - 07:58 AM
Post #2

New D.I.C Head
*

Joined: 6 Jul, 2008
Posts: 10



Thanked: 3 times
My Contributions
QUOTE(yanom @ 19 Aug, 2008 - 09:52 AM) *

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?
User is offlineProfile CardPM
+Quote Post

MitkOK
RE: Ok, Now This Is Just Weird.
19 Aug, 2008 - 08:08 AM
Post #3

D.I.C Regular
Group Icon

Joined: 9 Aug, 2007
Posts: 314



Thanked: 12 times
Dream Kudos: 250
My Contributions
This code works on Ubuntu, most probably your indentation is not appropriate.
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 12/2/08 01:58PM

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month