概述
这是我的代码的缩写。
{{cd2>只想在窗口中弹出{cd2>。在
然而,目前,[input2]和[solve]窗口同时弹出,解决了!单击按钮时不执行任何操作。在
这是我的代码:from tkinter import *
class welcome():
def __init__(self, master): #master: root - the main window
# welcome and introduction
self.master=master
self.master.geometry("500x200")
self.welcome = Label(self.master, text="Welcome to The Bees's")
self.welcome.pack()
self.intro = Label(self.master, text="This is our project for Python course")
self.intro.pack()
self.intro2 = Label(self.master, text="This program is use for solving Linear Programming, IP, BIP, mixed... problem")
self.intro2.pack()
self.startbutton = Button(self.master, text="Start", bg="yellow")
self.startbutton.pack()
self.startbutton.config(command=self.gotoinput)
def gotoinput(self):
root2 = Toplevel(self.master)
self.input1=input(root2)
输入窗口的类:
^{pr2}$
input2窗口的类:class input2():
def __init__(self,master):
self.master=master
self.master.title("Input2")
self.master.geometry("700x500")
# cancle
self.Canclebutton = Button(self.master, text="Cancle", command=self.master.destroy).grid(row=0, column=0)
# OK
self.Solvebutton = Button(self.master, text="Solve!", command=self.gotosolve()).grid(row=0, column=1)
print("Through")
def gotosolve(self):
print("gotosolve")
root4=Toplevel(self.master)
self.solve11=solve(root4)
求解窗口的类:class solve():
def __init__(self,master):
self.master = master
self.master.title("Solution")
self.master.geometry("700x500")
# cancle
self.Canclebutton = Button(self.master, text="Cancle", command=self.master.destroy).grid(row=0,column=0)
主要功能:def main():
# create a main window
root = Tk()
root.title("The Bees's")
b = welcome(root)
# end line
root.mainloop()
main()
最后
以上就是动听烧鹅为你收集整理的python 提示框如何顶层显示_如何控制顶层窗口的显示?的全部内容,希望文章能够帮你解决python 提示框如何顶层显示_如何控制顶层窗口的显示?所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复