0
我正在制作一个关于电子学习的应用程序。在这个特定的页面上,我希望能够让用户从简单,中等和难度中选择难度级别的按钮。按下按钮后,用户将进入下一页EasyLevel,ModerateLevel或HardLevel。如何解决我的代码?Python TKinter GUI
import Tkinter
LevelBox = Tkinter.Tk()
LevelBox.geometry("320x260")
LevelBox.title("Diffuculty")
LevelBox.withdraw()
def Easy() :
LevelBox.withdraw()
easybox.deiconify()
return
def Moderate() :
LevelBox.withdraw()
moderatebox.deiconify()
return
def Hard() :
LevelBox.withdraw()
hardbox.deiconify()
return
b1 = Tkinter.Button (LevelBox, text="Easy", command=Easy,height=1,width=7).grid(row=1,column=1,sticky="e",pady=5,padx=5)
b1 = Tkinter.Button (LevelBox, text="Moderate", command=Moderate,height=1,width=7).grid(row=1,column=3,sticky="w",pady=5,padx=5)
b1 = Tkinter.Button (LevelBox, text="Hard", command=Hard,height=1,width=7).grid(row=2,column=1,sticky="e",pady=5,padx=5)
easybox = Tkinter.Toplevel()
easybox.geometry("320x260")
easybox.title("Easy Questions")
easybox.withdraw()
moderatebox = Tkinter.Toplevel()
moderatebox.geometry("320x260")
moderatebox.title("Moderate Questions")
moderatebox.withdraw()
hardbox = Tkinter.Toplevel()
hardbox.geometry("320x260")
hardbox.title("Hard Questions")
hardbox.withdraw()
__tkinter.TclError:坏属性 “-toolwindow”:必须是-α,-topmost,-zoomed,-fullscreen,或-type_ – zondo
我米使用python 2.7.11,可能是因为版本而发生的。所以我必须在python 3.5中导入Tkinter,它应该是这样的** import tkinter as tk ** ..你使用的是什么版本的python? –
我在Python2.7.6和Python3.4.3中试过它,并且在两者中都得到相同的错误。 – zondo