2
我正在嘗試使用python和tkinter來創建一個程序,該程序運行在複選框中選中的程序。從python tkinter的複選框中獲取輸入?
import sys
from tkinter import *
import tkinter.messagebox
def runSelectedItems():
if checkCmd == 0:
labelText = Label(text="It worked").pack()
else:
labelText = Label(text="Please select an item from the checklist below").pack()
checkBox1 = Checkbutton(mGui, variable=checkCmd, onvalue=1, offvalue=0, text="Command Prompt").pack()
buttonCmd = Button(mGui, text="Run Checked Items", command=runSelectedItems).pack()
這是代碼,但我不明白爲什麼它不工作?
謝謝。
[獲取Tkinter的複選框的狀態]的可能重複(http://stackoverflow.com/questions/4236910/getting-tkinter-check-box-state) – 2014-01-15 09:27:35