How can i change the font on ttk.Entry
Asked Answered
L

1

11

Is there any way to change the ttk.Entry font I've tried with the ttk.style but TypeError occurs.

Like:

my_style = ttk.Style('TEntry' , font = ('Arial' , 10 , 'bold'))
my_entry = ttk.Entry(master)
my_entry.pack()
Lodhia answered 23/12, 2013 at 13:22 Comment(0)
S
14

Specify font in ttk.Entry constructor.

For example:

from Tkinter import * # from tkinter import *    IN Python 3.x
import ttk

master = Tk()
my_entry = ttk.Entry(master, font=('Arial', 10, 'bold')) # <-----
my_entry.pack()

mainloop()
Stratocumulus answered 23/12, 2013 at 14:0 Comment(2)
YES SIR!!! I fill so idiot that i didnt try that before i ask but i thought that all ttk widgets use the style class to specify the font options , THANK you very much!Lodhia
Apropos @LuciusSilanus’s comment, the problem is apparently with the underlying ttk library, and not with Python itself. It’s unclear why you can’t style ttk.Entry.Bree

© 2022 - 2024 — McMap. All rights reserved.