Ok, so I'm trying to call a function called Func1 by having a menu that lets me input numbers for the options in the menu (
[1] Energy
[2] Weapon systems
etc. Now I want the user to input a number (i.e.1) and the program jumps to that point in the program.
my current code is this:
[code]
def Menu():
width = os.get_terminal_size().columns
print("Schiffssysteme".center(width, '='))
print("[1] Energiesystem")
print("[2] Sonstige Systeme")
print("=".center(width, '='))
Eingabe = input("Auswahl: ")
try: #to test if input is a number
Eingabe = int(Eingabe)
except ValueError:
print("Bitte Zahl eingeben!")
sleep(1)
Menu()
try: # to convert it back to a string
Eingabe = str(Eingabe)
except ValueError:
print("")
xyz = "'" # Problem part: I want the program to jump to an earlier mentioned Function Func1/Func2
callfunc = xyz + "Func" + Eingabe + "()" + xyz
print(callfunc)
eval(callfunc)
[/code]