Applet Python won't Run

Discussion in 'Mac Programming' started by Xarver, Feb 12, 2009.

  1. Xarver
    Expand Collapse
    macrumors newbie

    Feb 12, 2009
    Hi I have this code:
    # 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"):
    	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)
    		guess = ""
    		tries = 0
    		while (guess != word):
    			guess = raw_input("Try to guess the word: ")
    			tries += 1
    			if (tries > 5):
    				print "Sorry, you lost!"
    			if (guess != word):
    				print "Nope!"
    				print "Congrats! You won the game! :)"
    		print "Invalid Entry!!!\n"
    I right click the and run with Build Applet and get
    I double-click the .app file and nothing happens.
    I'm running MacOSX 10.4 on an old iMac... What's wrong?
  2. Xarver
    Expand Collapse
    thread starter macrumors newbie

    Feb 12, 2009
    By the way I'm using Active Python 2.5.2 For Mac. :)
  3. Winni
    Expand Collapse
    macrumors 68030


    Oct 15, 2008
    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 and it should work.

Share This Page