码迷,mamicode.com
首页 > 其他好文 > 详细

Tkinter

时间:2016-06-12 01:38:46      阅读:199      评论:0      收藏:0      [点我收藏+]

标签:

单个选项

from Tkinter import *
root = Tk()

v = IntVar()

Radiobutton(root, text="One", variable=v, value=1).pack(anchor=W)
Radiobutton(root, text="Two", variable=v, value=2).pack(anchor=W)
Radiobutton(root, text="Three", variable=v, value=3).pack(anchor=W)

l = Label(root,textvariable=v)
l.pack()
mainloop()
from Tkinter import *

master = Tk()

LANGS = [
    ("Python", 1),
    ("Perl", 2),
    ("Ruby", 3),
    ("Lua", 4)]

v = IntVar()
v.set(1)
for lang, num in LANGS:
    b = Radiobutton(master, text=lang, variable=v, value=num, indicatoron=False)
    b.pack(fill=X)

mainloop()

 

 

技术分享

 

Tkinter

标签:

原文地址:http://www.cnblogs.com/lly-001/p/5576291.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!