There are times when a user wants to insert the information like Name, contact number, Email, address, etc. Tkinter has a simple way to handle these types of inputs through its Entry widgets. Tkinter Entry widgets can be styled using the ttk package.
To change other properties of the Entry widgets such as font properties, text-size, and font-style, we can use the font(‘font-family font-size font-style’) attribute. We can specify the font property in the entry constructor.
Example
#Import tkinter library from tkinter import * from tkinter import ttk #Create an instance of tkinter frame or window win= Tk() #Set the geometry of tkinter frame win.geometry("750x250") #Create an Entry Widget entry= ttk.Entry(win,font=('Century 12'),width=40) entry.pack(pady= 30) win.mainloop()
Output
Executing the above code will display a window that contains a customized Entry widget.
To change the font property, we can modify the values of the font attributes in the code.