10

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()
Cœur
  • 37,241
  • 25
  • 195
  • 267
L0aD1nG
  • 111
  • 1
  • 10

1 Answers1

13

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()
falsetru
  • 357,413
  • 63
  • 732
  • 636
  • 4
    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! – L0aD1nG Dec 23 '13 at 17:01
  • 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`. – Manngo Sep 08 '21 at 01:49