How do you set the default font for Tk widgets
-
05-07-2019 - |
Question
I have a Tcl/Tk app that generates many forms and would like to be able to configure the default widget fonts from a central location without having to configure each widget with the -font
switch.
#!<path>/wish
button .hello -text "Hello, World!" -command { exit }
pack .hello
puts "--- i would like to set this thing: [.hello configure -font] --- "
Solution
Try adding,
font create myDefaultFont -family Helvetica -size 20
option add *font myDefaultFont
to the top of your script. (link to article on fonts)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow