Python 3 Tkinter Give Focus to Text Widget on App Startup GUI Desktop App Full Project For Beginners

 

 

main.py

 

 

#Import tkinter library
from tkinter import *
from PIL import Image,ImageTk
#Create an instance of tkinter frame
win = Tk()
#Set the geometry
win.geometry("750x250")
#Create a Text WIdget
text= Text(win, width= 30, height= 10)
text.insert(INSERT, "Hello World!")
#Activate the focus
text.focus_set()
text.pack()
#Create an Entry Widget
entry=Entry(win,width= 30)
entry.pack()
win.mainloop()

Leave a Reply