所以,这是我的代码。我希望它与我的数量条目相关联,但它不起作用。每当我检查按钮时,数量输入仍然被禁用。
Pizza = Checkbutton(root,variable=var12,onvalue = 1,offvalue=0, bg="powder blue",command=chk_Pizza)
Pizza.place(x=160,y=355)
txtPizza=Entry(root,font=('arial',8,'bold'),bd=4,width=4,state=DISABLED,textvariable=E_Pizza)
txtPizza.place(x=195,y=355)
HotDog = Checkbutton(root,variable=var2,onvalue = 1,offvalue=0, bg="powder blue",command=chk_HotDog)
HotDog.place(x=160,y=450)
txtHotDog=Entry(root,font=('arial',8,'bold'),bd=4,width=4,state=DISABLED,textvariable=E_HotDog)
txtHotDog.place(x=195,y=450)
Wings = Checkbutton(root,variable=var3,onvalue = 1, bg="powder blue",offvalue=0,command=chk_Wings)
Wings.place(x=160,y=555)
txtWings=Entry(root,font=('arial',8,'bold'),bd=4,width=4,state=DISABLED,textvariable=E_Wings)
txtWings.place(x=195,y=555)
Burrito = Checkbutton(root,variable=var4,onvalue = 1, bg="powder blue",offvalue=0,command=chk_Burrito)
Burrito.place(x=160,y=650)
txtBurrito=Entry(root,font=('arial',8,'bold'),bd=4,width=4,state=DISABLED,textvariable=E_Burrito)
txtBurrito.place(x=195,y=650)
Hamburger = Checkbutton(root,variable=var5,onvalue = 1, bg="powder blue",offvalue=0,command=chk_Hamburger)
Hamburger.place(x=445,y=384)
txtHamburger=Entry(root,font=('arial',8,'bold'),bd=4,width=4,state=DISABLED,textvariable=E_Hamburger)
txtHamburger.place(x=480,y=384)
Fries = Checkbutton(root,variable=var6,onvalue = 1, bg="powder blue",offvalue=0,command=chk_Fries)
Fries.place(x=445,y=480)
txtFries=Entry(root,font=('arial',8,'bold'),bd=4,width=4,state=DISABLED,textvariable=E_Fries)
txtFries.place(x=480,y=480)
就在这里,每当我一个一个检查炸玉米饼或甜甜圈并喝下去时,按钮都在检查。
Tacos = Checkbutton(root,variable=var7,onvalue = 1,bg="powder blue", offvalue=0,command=chk_Taco)
Tacos.place(x=445,y=580)
txtTaco=Entry(root,font=('arial',8,'bold'),bd=4,width=4,state=DISABLED,textvariable=E_Taco)
txtTaco.place(x=480,y=580)
Donut = Checkbutton(root,variable=var7,onvalue = 1,bg="powder blue", offvalue=0,command=chkDonut)
Donut.place(x=780,y=380)
txtDonut=Entry(root,font=('arial',8,'bold'),bd=4,width=4,state=DISABLED,textvariable=E_Donut)
txtDonut.place(x=815,y=380)
Icecream = Checkbutton(root,variable=var7,onvalue = 1,bg="powder blue", offvalue=0,command=chkIcecream)
Icecream.place(x=780,y=470)
txtIcecream=Entry(root,font=('arial',8,'bold'),bd=4,width=4,state=DISABLED,textvariable=E_Icecream)
txtIcecream.place(x=815,y=470)
Cupcake = Checkbutton(root,variable=var7,onvalue = 1,bg="powder blue", offvalue=0,command=chk_Cupcake)
Cupcake.place(x=780,y=585)
txtCupcake=Entry(root,font=('arial',8,'bold'),bd=4,width=4,state=DISABLED,textvariable=E_Cupcake)
txtCupcake.place(x=815,y=585)
Smoothie = Checkbutton(root,variable=var7,onvalue = 1,bg="powder blue", offvalue=0,command=chk_Smoothie)
Smoothie.place(x=1150,y=342)
txtSmoothie=Entry(root,font=('arial',8,'bold'),bd=4,width=4,state=DISABLED,textvariable=E_Smoothie)
txtSmoothie.place(x=1185,y=342)
Coffee = Checkbutton(root,variable=var7,onvalue = 1,bg="powder blue", offvalue=0,command=chk_Coffee)
Coffee.place(x=1150,y=445)
txtCoffee=Entry(root,font=('arial',8,'bold'),bd=4,width=4,state=DISABLED,textvariable=E_Coffee)
txtCoffee.place(x=1185,y=445)
Cocktail = Checkbutton(root,variable=var7,onvalue = 1,bg="powder blue", offvalue=0,command=chk_Cocktail)
Cocktail.place(x=1150,y=550)
txtCocktail=Entry(root,font=('arial',8,'bold'),bd=4,width=4,state=DISABLED,textvariable=E_Cocktail)
txtCocktail.place(x=1185,y=550)
drink = Checkbutton(root,variable=var7,onvalue = 1,bg="powder blue", offvalue=0,command=chk_Softdrink)
drink.place(x=1150,y=655)
txtdrink=Entry(root,font=('arial',8,'bold'),bd=4,width=4,state=DISABLED,textvariable=E_Softdrink)
txtdrink.place(x=1185,y=655)
这不是全部代码,我的代码太长了,所以我没有在这里粘贴整个代码。
我有第二个问题,我希望窗口成为我系统的前面,但它没有发生。我使用 tk,我的窗户的顶层,我的前窗应该使用什么?或者有合适的位置吗?我的意思是它应该在我的整个代码之上吗?谢谢!