I'm working on a GUI in Python2.7, with Tkinter, and I have an annoying problem.
I would like to define the default font used by all the widgets, if possible in one line. This line modify only the font used in Entry, or ComboBox:
root.option_add("*Font", "courier 10")
but not the label of checkbox by example.
I found that a predefined font exist "TkDefaultFont" but I'm unable to change its configuration:
print tkFont.Font(font='TkDefaultFont').configure()
tkFont.Font(font='TkDefaultFont').config(family='Helvetica', size=20)
tk.TkDefaultFont = tkFont.Font(family="Helvetica",size=36,weight="bold")
print tkFont.Font(font='TkDefaultFont').configure()
return :
{'family': 'DejaVu Sans', 'weight': 'normal', 'slant': 'roman', 'overstrike': 0, 'underline': 0, 'size': -12} {'family': 'DejaVu Sans', 'weight': 'normal', 'slant': 'roman', 'overstrike': 0, 'underline': 0, 'size': -12}
(no errors, but nothing change !!)
What I'm doing wrong ?
See Question&Answers more detail:os