Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/user-interface/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
User interface 如何设置Tk小部件的默认字体_User Interface_Fonts_Tcl_Tk - Fatal编程技术网

User interface 如何设置Tk小部件的默认字体

User interface 如何设置Tk小部件的默认字体,user-interface,fonts,tcl,tk,User Interface,Fonts,Tcl,Tk,我有一个Tcl/Tk应用程序,可以生成许多表单,并且希望能够从中心位置配置默认的小部件字体,而不必使用-font开关配置每个小部件 #!<path>/wish button .hello -text "Hello, World!" -command { exit } pack .hello puts "--- i would like to set this thing: [.hello configure -font] --- " #/希望 button.hello-文本“hel

我有一个Tcl/Tk应用程序,可以生成许多表单,并且希望能够从中心位置配置默认的小部件字体,而不必使用
-font
开关配置每个小部件

#!<path>/wish
button .hello -text "Hello, World!" -command { exit }
pack .hello
puts "--- i would like to set this thing: [.hello configure -font] --- "
#/希望
button.hello-文本“hello,World!”-命令{exit}
打包,你好
puts“---我想设置这个东西:[.hello configure-font]--”
尝试添加

font create myDefaultFont -family Helvetica -size 20
option add *font myDefaultFont

到脚本的顶部

这正是我想要的。谢谢如果您不熟悉Tk的命名字体概念,那么使用上面的方法可以在以后的运行时更改字体。您所需要做的就是重新配置myDefaultFont,使用该字体的每个小部件将立即使用新字体重新绘制自身。不需要手动迭代所有的小部件。看起来这篇文章已经消失了。回程机显示: