Python3 tkinter基础 Radiobutton variable 默认选中的按钮,python3tkinter,?python :
Python3 tkinter基础 Radiobutton variable 默认选中的按钮,python3tkinter,?python :
?
python : 3.7.0OS : Ubuntu 18.04.1 LTS
IDE : PyCharm 2018.2.4conda : 4.5.11type setting : Markdown
?
code
"""@Author : 行初心@Date : 18-10-1@Blog : www.cnblogs.com/xingchuxin@GitHub : github.com/GratefulHeartCoder"""from tkinter import *def main(): root = Tk() v = IntVar() v.set(2) # 如果1,那么儒家被默认选中 # 如果2,那么道家被默认选中 # 如果3,那么佛家被默认选中 rb1 = Radiobutton(root, text=‘儒家‘, variable=v, value=1) rb1.pack() rb2 = Radiobutton(root, text=‘道家‘, variable=v, value=2) rb2.pack() rb3 = Radiobutton(root, text=‘佛家‘, variable=v, value=3) rb3.pack() mainloop()if __name__ == ‘__main__‘: main()
?
result
?
reference
[文档] https://docs.python.org/3/library/tkinter.html?
resource
[文档] https://docs.python.org/3/[规范] https://www.python.org/dev/peps/pep-0008/[规范] https://zh-google-styleguide.readthedocs.io/en/latest/google-python-styleguide/python_language_rules/[源码] https://www.python.org/downloads/source/[ PEP ] https://www.python.org/dev/peps/[平台] https://www.cnblogs.com/?
Python具有开源、跨平台、解释型和交互式等特性,值得学习。
Python的设计哲学:优雅,明确,简单。提倡用一种方法,最好是只有一种方法来做一件事。
GUI可以选择PyQt5、PySide2、wxPython、PyGObject、wxWidgets等进行创作。
代码的书写要遵守规范,这样有助于沟通和理解。
每种语言都有独特的思想,初学者需要转变思维、踏实践行、坚持积累。
Python3 tkinter基础 Radiobutton variable 默认选中的按钮
相关内容
- python 处理中文 读取数据库输出全是问号,,ref:http:/
- python (turtle)画五环,,实现代码:impor
- python 报错TypeError: 'range' object does not suppo
- python selenium模块使用出错-selenium.common.exceptions.WebDrive
- Python3安装geohash,,Geohash是一个
- python 验证码处理,,一、灰度处理,就是把
- 【Python web 开发】微博授权登录,获取access_token,,1、
- 图像标注工具labelImg安装方法(win7+Python3.5+Qt5),labe
- python 创建虚拟环境时报错OSError, setuptools下载失败,,错
- python评分卡,,1.项目背景介绍1.
评论关闭