strong文本首先,我是StackOverflow新手。你知道吗
该程序完全可以在IDE中运行。我用pyinstaller把它转换成exe。我发现在我得到主界面显示的结果之前,即使我没有关闭窗口,它也会自动退出。你知道吗
我在程序中所做的是,它在后台获取输入并进行数据处理,将结果写入excel文件,并在主UI中显示摘要,如picture。现在在Windows10上,它不会显示摘要,只会退出,但excel文件是正确的。你知道吗
所以我需要一些帮助。你知道吗
class MainUI(tk.Tk):
def __init__(self):
super().__init__()
self.title('Checkout Tool V1.0 -- by Bo Kuang')
self.geometry('852x800')
self.continue_signal = False
...read file
self.BlankLine = tk.Label(self, text=' ', width=1, height=1)
self.CreatePage()
self.menuCounter = 0
self.runHit = False
def CreatePage(self):
image = Image.open('Welcome.PNG')
photo = ImageTk.PhotoImage(image, master=self)
label_i = tk.Label(self, image=photo)
label_i.image = photo
label_i.pack(side='top')
FirstLine = tk.Label()
FirstLine.pack()
RemindLine = tk.Label()
RemindLine.pack()
RunBotton = tk.Button(self, text='Run', command=self.RunConfig)
RunBotton.pack()
def RunConfig(self):
if self.runHit == False:
self.runHit = True
confirm_click = tk.messagebox.askyesno('')
for i in range(int( 18/2)):
tk.Label(self, text=item[i]).place(x=200 ,y=340+40*i)
urlLabel = tk.Label(self, text=display_result_list[i])
urlLabel.place(x=350 ,y=340+40*i)
class RunUI(tk.Toplevel):
def __init__(self):
super().__init__()
self.title('Input parameter window')
self.geometry('426x240')
tk.Label(self, text=).place(x=10, y=10)
self.diev = tk.StringVar()
self.diev.set('Decimal')
tk.Label(self, text='DIE stack').place(x=10, y=80)
entry_die_value = tk.Entry(self, textvariable=self.diev)
entry_die_value.place(x=150, y=80)
self.bind("<Return>", lambda x:self.ok())
ContinueButton = tk.Button(self, text='OK', height=1, command=self.ok)
ContinueButton.place(x=180, y=185)
def ok(self):
if self.para20v.get() not in ...:
if int(self.diev.get(), 16) not in [1, 2, 4, 8, 16]:
self.continue_signalv = False
tk.messagebox.showwarning()
self.deiconify()
elif int(self.cev.get(), 16) not in [1, 2, 4]:
self.continue_signalv = False
tk.messagebox.showwarning()
self.deiconify()
else:
self.continue_signalv = True
self.result_list = [...]
tk.messagebox.showinfo ()
self.destroy()
app = MainUI()
app.mainloop()
print('CLOSED')
我解决了这个问题。好像绘图。关闭()从matplotlib导入关闭了GUI进程,因此我使用Figure而不是plot,它工作得很好。 但我不知道为什么它没有出现在Spyder IDE中
相关问题 更多 >
编程相关推荐