【发布时间】:2017-02-28 14:17:36
【问题描述】:
我有这个python脚本,在python tkinter模块中config()有什么用?
from tkinter import *
root=Tk()
def sel():
s=v.get()
if s=="m":
l.config(text="CORRECT ANSWER!!!")
else:
l.config(text="WRONG ANSWER")
v=StringVar()
a=Label(root,text="Delhi is the capital of India.",bg="wheat",fg="blue")
a.pack()
r1=Radiobutton(root,text="True",variable=v,value="m",command=sel)
r1.pack(anchor=W)
r2=Radiobutton(root,text="False",variable=v,value="n",command=sel)
r2.pack(anchor=W)
l=Label(root,bg="ivory",fg="darkgreen")
l.pack()
root.mainloop()
【问题讨论】:
-
你有没有做过基础研究,比如阅读一些文档?
标签: python-2.7 python-3.x tkinter