my golf game needs gui
hi i've been writing a golf game in text only. this was to work out some of details. it's great but making a golf course with ---'s and |||'s is kinda silly looking. (at least to some..) now i'm ready to begin shopping for a gui widget to work with python so my players can have some kind of pictures and possibly some motion. i won't be creating figures swinging the golf clubs but would like to show their golf ball flying thru the air and land on the green for one example. will pyQT work for me? any suggestions on which way I should go next? i would like my game to work on linux and possibly windows as well, unless developing for windows means i will have to write it all over again.. let me know what your reactions are. thanks. -- http://mail.python.org/mailman/listinfo/python-list
try: except: ValueError
hi my goal is to handle the problem of a user typing a letter or symbol rather than a number I found something called try: and ValueError: Anyway this is what i attempted: #menuloop menuChoice = 7 printMenu() while menuChoice != 0: try: menuChoice = int("1 = write | 2 = view | 0 = quit")) except ValueError: print "enter a number" if menuChoice == 1: writeEntry() elif menuChoice == 2: viewEntry() elife menuChoice == 0: pass else: printMenu() print "bye" this works as though I never added try: and except ValueError: at all. the program just doesn't use them at all. if a user types a&s it still errors 'a&s' is not defined what am i doing wrong here? -- http://mail.python.org/mailman/listinfo/python-list
Re: try: except: ValueError
> The solution is to use raw_input() which returns the user input as a string. > Then you can do whatever validation you wish, e.g. > menuChoice = int(raw_input("1 = write | 2 = view | 0 = quit")) > which will raise an exception if the input is not a valid integer. yes that did it, thanks -- http://mail.python.org/mailman/listinfo/python-list