Share the tools you created for a short time in sales. I created it with Spyder (Python 3.7) while checking it on Google.
import tkinter as tk
root=tk.Tk()
root.geometry('300x200')
root.title('Employee')
def btn_click():
x=txt_1.get()
if x=="Tanaka":
txt_2.insert(0,1)
elif x=="Suzuki":
txt_2.insert(0,2)
elif x=="Yamada":
txt_2.insert(0,3)
else:
txt_2.insert(0,"Not applicable")
lbl_1 = tk.Label(text='Last name')
lbl_1.place(x=30, y=70)
lbl_2 = tk.Label(text='employee number')
lbl_2.place(x=30, y=100)
txt_1 = tk.Entry(width=20)
txt_1.place(x=90, y=70)
txt_2 = tk.Entry(width=20)
txt_2.place(x=90, y=100)
btn = tk.Button(root, text='Run', command=btn_click)
btn.place(x=140, y=170)
root.mainloop()
Recommended Posts