Python 3 Tkinter Remove Focus From EntryBox Widgets GUI Desktop App Full Project For Beginners

 

 

main.py

 

 

#Import the required Libraries
from tkinter import *
from tkinter import ttk
from tkinter import messagebox

#Create an instance of Tkinter frame
win = Tk()
#Set the geometry of Tkinter Frame
win.geometry("750x250")

#Define a function to show the message
def logged_in():
   messagebox.showinfo("Message", "Successfully Logged In!")
   win.destroy()

#Define a Label widget
Label(win, text= "Login to the System", font=('Aerial', 14, 'bold')).pack(pady=15)
#Create an entry widget
Label(win, text="Enter Username").pack()
username= Entry(win, width= 20)
username.pack()
Label(win, text= "Enter passowrd").pack()
password= Entry(win, show="*", width= 20)
password.pack()
password.focus_set()
#Add a Bottom widget
button=ttk.Button(win, text="Login", command= logged_in)
button.pack(pady=13)

#Create a Button widget
win.mainloop()

Leave a Reply