I wanna enter a number in the following code with enter and not with the button. It works with the button but i don't know how to give in the input with pressing enter and not the button
def lego():
if userinput.get() == '3':
if filesd['jdisk']['status'] == 'true':
print('Laufwerk J: ist bereits belegt.')
else:
os.system('net use J: \\\\testpath\\testpath')
filesd['jdisk']['status'] = 'true'
luserinput = Label(root, text="Zeichen eingeben um Python-Befehl auszuführen:")
userinput = Entry(root)
lbutton = Button(root, text="Search", command=lego)
Thanks to furas:
userinput.bind('<Return>', lego)
And you need:
def lego(event):