Nicola De Quattro wrote: > while(var !=q0) > print """ > Please select an action from the menu below: > -------------------------------------- > o) Open an image > +) Rotate the image of 1° clockwise > -) Rotate the image of -1° clockwise > r) Rotate the image of an input degree > s) Show the image > a) Save the image > q) Quit Tipsy Imp > -------------------------------------- > """ > var = raw_input("Make a choice: ");
"var" is a rather meaningless name for a variable. Something like "choice" might be better here. BTW, you might want to look into a GUI toolkit. There's tkinter that comes with Python, and there are many others that aren't hard to use either. http://wiki.python.org/moin/FrontPage?action=fullsearch&context=180&value=gui&titlesearch=Titel > ------------------------------------------------ > > I've some questions: > 1) Is there a switch-case statement in Python? It seems to me not. How > do you suggest to proceed in order to switch into var values? Use a dict that maps characters to functions and then lookup_dispatch_function = { 'o' : open_image, ... }.get def error_fallback(): print("Invalid input, try again") # ... choice = raw_input("Make a choice: ") handle_input = lookup_dispatch_function( choice.strip(), error_fallback) handle_input() Stefan _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor