the Font size not work in Entry #515
Replies: 1 comment
|
This is a ttk quirk rather than a ttkbootstrap bug: Two ways to actually change it: 1. Set the font as a widget option (simplest — per widget): self.entry = ttk.Entry(bootstyle='info', font=('Helvetica', 24))
# or after creation:
self.entry.configure(font=('Helvetica', 24))2. Reconfigure a named font (one handle for many entries, updates live): from tkinter import font
# Option A: change the default font every text widget already uses
font.nametofont('TkTextFont').configure(size=24)
# Option B: define your own named font and attach it to the entry
my_font = font.Font(name='EntryFont', family='Helvetica', size=24)
self.entry = ttk.Entry(bootstyle='info', font='EntryFont')
# later, restyle every entry using it at once:
my_font.configure(size=18)Because the entry holds a reference to the named font, mutating the font object reflows every widget using it — no need to touch each entry. The gotcha to avoid: |

This is a ttk quirk rather than a ttkbootstrap bug:
ttk::entrydoesn't read its font from the style.style.configure('info.TEntry', font=('Helvetica', 24))is accepted and stored (you can see it viattk::style lookup info.TEntry -font), but the entry never renders it — so the text stays small. UnlikeTLabel/TButton, the editable text widgets (TEntry,TCombobox,TSpinbox) carry-fontas a widget option that defaults to the named fontTkTextFont, and the widget always uses that instead of the style.Two ways to actually change it:
1. Set the font as a widget option (simplest — per widget):