#---------------------------------------------------------------------- # Basic command processor # # Copyright (C) October 11, 2017 -- Dr. William T. Verts # # This program ilustrates a number of new Python structures, including # quoted strings that span lines, the string function to make all # characters lower case, the raw_input function, the pass statement # to act as a placeholder for future code, and the use of bool # (Boolean) variables to control a loop. #---------------------------------------------------------------------- def Main(): # Message uses the "triple-double-quote" of Python to build a # string that spans lines and contains line-breaks. Between the # opening """ and the closing """ all characters are valid, so # indentation is not used. Message = """ stop brighten darken morered moregreen moreblue Enter a command --- """ Stop = False while (not Stop): Command = raw_input(Message) # Use requestString(Message) for JES dialog box Command = Command.lower() # Convert string to lower case (users may enter upper case by accident) if (Command == "stop"): Stop = True elif (Command == "brighten"): pass # We'll replace these in later elif (Command == "darken"): pass # We'll replace these in later elif (Command == "morered"): pass # We'll replace these in later elif (Command == "moregreen"): pass # We'll replace these in later elif (Command == "moreblue"): pass # We'll replace these in later else: print Command + " is an illegal command" # Use showMessage(...) for JES dialog box return