Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Feb 12, 2009, 04:35 PM   #1
Xarver
macrumors newbie
 
Join Date: Feb 2009
Applet Python won't Run

Hi I have this code:
Code:
#RandomWordGame.py
# Computer picks a random word, and the user has to guess it.
#Script by Xarver
import random

letterwords3 = ("pie", "cat", "dog", "boy", "pop", "man", "fun")
letterwords4 = ("cake", "girl", "poop", "race", "nice", "cool", "game")
letterwords5 = ("sweet", "funny", "drool", "rocks")

print """\
Welcome to the Random Word Game!!!
Try to guess the random word in 6 tries or less!
\tEnter 1 to play!
\tEnter q to quit.
\t(Enter cheater to list all the words!!!)\n"""
while True:
	entry = raw_input("Your Choice: ")
	entry = entry
	if (entry == "cheater"):
		print letterwords3
		print letterwords4
		print letterwords5
	elif (entry == "q"):
		break;
	elif (entry == "1"):
		enter = int(raw_input("Enter 1 for 3letter game, 2 for 4lettergame, and 3 for 5letter game: "))
		if (enter == 1):
			word = random.choice(letterwords3)
		elif (enter == 2):
			word = random.choice(letterwords4)
		elif (enter == 3):
			word = random.choice(letterwords5)
		else:
			break;
		guess = ""
		tries = 0
		while (guess != word):
			guess = raw_input("Try to guess the word: ")
			tries += 1
			if (tries > 5):
				print "Sorry, you lost!"
				break;
			if (guess != word):
				print "Nope!"
			else:
				print "Congrats! You won the game! :)"
	else:
		print "Invalid Entry!!!\n"
I right click the RandomWordGame.py and run with Build Applet and get RandomWordGame.app
I double-click the .app file and nothing happens.
I'm running MacOSX 10.4 on an old iMac... What's wrong?

Last edited by Xarver; Feb 12, 2009 at 05:08 PM.
Xarver is offline   0 Reply With Quote
Old Feb 12, 2009, 05:19 PM   #2
Xarver
Thread Starter
macrumors newbie
 
Join Date: Feb 2009
By the way I'm using Active Python 2.5.2 For Mac.
Xarver is offline   0 Reply With Quote
Old Feb 12, 2009, 05:58 PM   #3
Winni
macrumors 68030
 
Winni's Avatar
 
Join Date: Oct 2008
Location: Germany.
There's nothing wrong. You just don't see anything because this is a console script, but an .app bundle should contain a GUI application if you want to see and interact with your program.

Launch your script from within Terminal (python myfile.py) and it should work.
__________________
Coming soon: http://endnacht.de.
Winni is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
thread Thread Starter Forum Replies Last Post
bash/python question lynkynpark86 Mac Programming 2 Jun 8, 2011 01:05 AM
Python terminal command? lynkynpark86 Mac Programming 2 May 28, 2011 04:28 PM
Macbook running XP with bootcamp won't run at 1280x800 native resolution dts0240 Mac Basics and Help 4 Jan 27, 2009 08:29 PM
Finder won't run/Hard Drive won't mount on restart!! johnny88 OS X 4 Nov 13, 2007 08:53 PM
iMac G4 won't upgrade past 10.4.3, iTunes won't run without 10.4.7! ab2650 PowerPC Macs 12 Oct 11, 2007 02:20 AM


All times are GMT -5. The time now is 05:26 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC