Java知识分享网 - 轻松学习从此开始!    

Java知识分享网

Java1234官方群25:java1234官方群17
Java1234官方群25:838462530
        
SpringBoot+SpringSecurity+Vue+ElementPlus权限系统实战课程 震撼发布        

最新Java全栈就业实战课程(免费)

springcloud分布式电商秒杀实战课程

IDEA永久激活

66套java实战课程无套路领取

锋哥开始收Java学员啦!

Python学习路线图

锋哥开始收Java学员啦!
当前位置: 主页 > Java文档 > Python技术 >

tkinter_nmt PDF 下载


分享到:
时间:2024-08-14 11:58来源:http://www.java1234.com 作者:转载  侵权举报
tkinter_nmt
失效链接处理
tkinter_nmt PDF 下载 

 
 
相关截图:
 
主要内容:

Here are some comments on how control variables are used with specific widgets:
✎ Button: You can set its textvariable to a StringVar. Anytime that variable is
changed, the text on the button will be updated to display the new value. This is not
necessary unless the button’s text is actually going to change: use the text attribute
if the button’s label is static.
✎ Checkbutton: Normally, you will set the widget’s variable option to an IntVar,
and that variable will be set to 1 when the checkbutton is turned on and to 0 when
it is turned off. However, you can pick different values for those two states with the
onvalue and offvalue options, respectively. You can even use a StringVar as the
checkbutton’s variable, and supply string values for the offvalue and onvalue.
Here’s an example:
self.spamVar = StringVar()
self.spamCB = Checkbutton ( self, text="Spam?",
variable=self.spamVar, onvalue="yes", offvalue="no" )
If this checkbutton is on, self.spamVar.get() will return the string "yes"; if the
checkbutton is off, that same call will return the string "no". Furthermore, your
program can turn the checkbutton on by calling .set("yes").
You can also the textvariable option of a checkbutton to a StringVar. Then
you can change the text label on that checkbutton using the .set() method on that
variable.
✎ Entry: Set its textvariable option to a StringVar. Use that variable’s .get()
method to retrieve the text currently displayed in the widget. You can also the
variable’s .set() method to change the text displayed in the widget.
✎ Label: You can set its textvariable option to a StringVar. Then any call to
the variable’s .set() method will change the text displayed on the label. This is
not necessary if the label’s text is static; use the text attribute for labels that don’t
change while the application is running.
✎ Menubutton: If you want to be able to change the text displayed on the menu
button, set its textvariable option to a StringVar() and use that variable’s
.set() method to change the displayed text.
✎ Radiobutton: The variable option must be set to a control variable, either an
IntVar or a StringVar. All the radiobuttons in a functional group must share the
same control variable. Set the value option of each radiobutton in the group to a
different value. Whenever the user sets a radiobutton, the variable will be set to
the value option of that radiobutton, and all the other radiobuttons that share the
group will be cleared.


 

------分隔线----------------------------

锋哥公众号


锋哥微信


关注公众号
【Java资料站】
回复 666
获取 
66套java
从菜鸡到大神
项目实战课程

锋哥推荐