Tkinter has many inbuilt methods and functions which are used to provide different features in the widgets. We can customize the font-property of text widget in a tkinter application using the font(‘font-family’,font-size, ‘style’) attribute. The tuple can be declared inside the Text constructor.
Example
Let us have a look at the following example where we will create a text widget with a customized font property. #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") #Define a text widget with font-property text= Text(win, height=15, font=('Times New Roman',17,'bold')) text.insert(INSERT, "Hey Folks!, Welcome to TutorialsPoint!") text.pack() win.mainloop()
Output
Running the above code will display a window that contains a text widget. The text written inside the text widget can be customized using the font property.