官术网_书友最值得收藏!

There's more...

With Checkbuttons, it is also possible to use other variable types:

var = tk.StringVar() 
var.set("OFF") 
checkbutton_active = tk.Checkbutton(master, text="Active?", variable=self.var, 
                                    onvalue="ON", offvalue="OFF", 
                                    command=update_value)

The only restriction is to match onvalue and offvalue with the type of the Tkinter variable; in this case, since "ON" and "OFF" are strings, the variable should be a StringVar. Otherwise, the Tcl interpreter will raise an error when trying to set the corresponding value of a different type.

主站蜘蛛池模板: 潍坊市| 临西县| 常德市| 镇远县| 齐齐哈尔市| 新兴县| 乌兰县| 临沧市| 大关县| 平乐县| 微山县| 邢台市| 威信县| 永安市| 葫芦岛市| 塔城市| 瑞安市| 江华| 平顺县| 罗山县| 灵寿县| 九江县| 民勤县| 普陀区| 建瓯市| 望谟县| 阿城市| 新泰市| 宝兴县| 山西省| 信阳市| 开远市| 中宁县| 邛崃市| 灵石县| 瑞昌市| 瓦房店市| 阿鲁科尔沁旗| 永平县| 清镇市| 息烽县|