How to set the font size of Entry widget in Tkinter?

TkinterPythonGUI-Programming

The Entry widget in tkinter is a basic one-line character Entry box that accepts single line user input. To configure the properties of the Entry widget such as its font-size and width, we can define an inline widget constructor.

Example

Here is an example of how you can define the font-size of the Entry widget.

# Import the required libraries
from tkinter import *
from tkinter import ttk

# Create an instance of tkinter frame or window
win=Tk()

# Set the size of the window
win.geometry("700x350")

# Create an Entry widget
entry=Entry(win, width=35, font=('Georgia 20'))
entry.pack()

win.mainloop()

Output

Run the above code to display a window with a customized Entry widget.

raja
Published on 05-Aug-2021 13:54:13
Advertisements