def getInput(question, type): while True: try: return type(gui.prompt(question)) except Exception: # Loop if they don't input correct type pass else: gui.alert("Goodbye!") quit()
def get_speed(self): print("Enter Move-Speed") speed = int( pymsgbox.prompt('Gps Speed: (1 for Walk, 2 for Run) >', title='Pokemon H@ck')) pymsgbox.alert(text=('Move Speed: ' + str(speed)), title='Pokemon H@ck', button="That's Fine") if (speed == 1): move_speed = 0.0001 else: move_speed = 0.0002 print("Got Speed: " + str(speed)) return float(move_speed)
def killProgram(cancel): if cancelSel == 'Cancel': gui.alert("Goodbye!") quit() else: pass
cancelSel = gui.confirm( "Enter your rough territory coordinates in unsigned decimal \ format, e.g. 87.152. Use at least four significant figures.", "Coordinate entry", ['OK', 'Cancel']) killProgram(cancelSel) # absolute value in case instructions are ignored geoLatMin = abs( float(getInput("Please enter your southernmost point", float))) geoLatMax = abs( float(getInput("Please enter your northernmost point", float))) geoLongMin = abs( float(getInput("Please enter your easternmost point", float))) geoLongMax = abs( float(getInput("Please enter your westernmost point", float))) except AttributeError: gui.alert("Goodbye!") quit() orgName = getInput("Please enter your organization's name", str) # upper() probably isn't required for Geocodio, but the rest of the address is all caps, so... stateVar = getInput("Please enter the two-digit code for your state", str).upper() # checks for length of two, and also that input is in upper/lowercase ascii letter set while not len(stateVar) == 2 or len( sorted(set(stateVar).difference(string.ascii_letters))) > 0: stateVar = getInput("Please enter the two-digit code for your state", str).upper() else: pass
def go(self): pymsgbox.alert("Use this coordinate?", "Easy-Walk", "Go!")
def proceed(self): pymsgbox.alert("Proceed?", "Easy-Walk", "Ok")