强文本,首先,我是StackOverflow的新手。
该程序可以在IDE中完美运行。我使用pyinstaller将其传输到exe。我发现在结果显示在主UI中之前,即使没有关闭窗口,它也会自动退出。
我在程序中所做的是,它在后台获取输入并进行数据处理,将结果写入excel文件,并在主界面(如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')
答案 0 :(得分:0)
我解决了这个问题。从matplotlib导入的plot.close()似乎关闭了GUI进程,因此我使用Figure而不是plot,效果很好。 但是我不知道为什么它没有在Spyder IDE中出现