Mar-02-2021, 03:41 PM
Hi,
I have the below code. What i want it to do is that when the button is clicked it outputs what is in the two entry boxes. However when I press the button nothing happens, what am I doing wrong?
finndude
I have the below code. What i want it to do is that when the button is clicked it outputs what is in the two entry boxes. However when I press the button nothing happens, what am I doing wrong?
import tkinter as tk window = tk.Tk() label = tk.Label(text="Type Below", fg="white", bg="black", width=10, height=5) label.grid(row=0) user_label=tk.Label(text="Username", fg= "white", bg="black", width=25, height=5) user_label.grid(row=1) pass_label=tk.Label(text="Password", fg= "white", bg="black", width=25, height=5) pass_label.grid(row=2) username_1=tk.Entry(fg="blue", bg="green", width=50) username_1.grid(row=1, column=1) password_1=tk.Entry(fg="blue", bg="green", width=50) password_1.grid(row=2, column=1) def clicked(): username=username_1.get() password=password_1.get() print (username) print(password) button=tk.Button(text="Click", fg="white", bg="blue", width=25, height=5, command="clicked") button.grid(row=3) window.mainloop()Many Thanks,
finndude