易截截图软件、单文件、免安装、纯绿色、仅160KB

Python:请教Tk中radiobutton控件的两个属性作用

请先看下面的简单代码:

Python code:

from tkinter import *

root = Tk()
v = IntVar()
v.set(0)

for i in range(3):
Radiobutton(root,
variable = v,
value = i).pack()
root.mainloop()



问题:
1、Radiobutton空间中的variable属性和value属性分别起到什么作用?
2、variable为什么赋值为v,然后给v赋值为0,可以正常工作,但是如果直接给variable赋值为0,就不行了呢?


谢谢!
value 指定的是 RadioButton 关联的值

Python code:
Command-Line Name: -value
Database Name: value
Database Class: Value
Specifies value to store in the button's associated variable whenever
this button is selected.



variable 指定的是 RadioButton 选中时设置的变量名,这个必须是全局的变量名,用 0 肯定是不行的

Python code:
Command-Line Name: -variable
Database Name: variable
Database Class: Variable
Specifies name of global variable to set whenever this button is selected.
Changes in this variable also cause the button to select or deselect itself.
Defaults to the value selectedButton.



谢谢你的指教,不


相关问答:

python 正则匹配中文

在文本文件中匹配项包含中文
如内容为:gamename=中文 
  key=天下
文本文件的编码的文件为utf-8
python代码如下:
# -*- coding:UTF-8 -*-
  contents=open(from_pa ......

python 图像多边形切割

python的PIL库自带的方法只能进行矩形的切割,如果我有了一个多边形各个顶点的坐标,如何对现有的图片按照这个多边形进行切割呢?
不一定要用PIL库,任何能实现这个功能的方法都行。

图片切割的js不是很多吗?
......

C# RSA Python - .NET技术 / C#

C#里面用using System.Security.Cryptography; RSACryptoServiceProvider加密过的消息
用Python Crypto中RSA的方法 能直接 解吗?
RSA加密方式不是统一的吗?需要注意些什么?

有帮助。但是没解决问题。。。
......

python写文件时出问题

异常代码如下:
write a file error: [Errno 2] No such file or directory: 'C:\x0cile.txt'

Traceback (most recent call last):
  File "C:\Documents and Settings\USER\桌面\复 ......

python中字符串比较的问题的问题

以下代码是Tk做了一个简单的密码验证功能,输入一个字符串,并验证其是否正确,请先看代码:
Python code:

from tkinter import *
root = Tk()
e = StringVar()
t = 'cashlu'
def yanzheng():
if e ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号