我创建了GUI窗口,用编辑器编译运行会显示窗口,但是生成EXE运行后,窗口不显示。图片中的窗口是用编译器编译运行的时候出现的,exe运行就黑框,直接就没了,也没报警,也没错误
class MY_GUI():
def __init__(self,init_window_name):
self.init_window_name = init_window_name
def set_init_window(self,li):
self.init_window_name.title("解析")
self.init_window_name.geometry('1068x681+10+10')
#self.scrolly=Scrollbar(self,width=25,orient=VERTICAL)
#self.scrolly.grid(row=0,column=1,padx=(0,0),pady=(0,0),sticky=NS)
self.listb = Listbox(self.init_window_name,width=60, height=35)
self.listb.grid(row=0, column=0)
self.result_data_Text = scrolledtext.ScrolledText(self.init_window_name, width=70, height=49)
self.result_data_Text.grid(row=0, column=12, rowspan=15, columnspan=10)
#listb['yscrollcommand']=scrolly.set
for item in li:
self.listb.insert("end",item)
#self.listb.bind('<Double-Button-1>',handlerAdaptor(printList,a=self.result_data_Text,b=self.listb))
self.str_trans_to_md5_button = Button(self.init_window_name, text="组包结果", bg="lightblue", width=10,command=self.myprintlist)
self.str_trans_to_md5_button.grid(row=1, column=11)
#self.init_window_name.mainloop
#return
def myprintlist(self):
print("###")
def start():
packets=rdpcap("./file.pcap")
li = deal_with_pcap(packets)
init_window = Tk()
ZMJ_PORTAL = MY_GUI(init_window)
# 设置根窗口默认属性
ZMJ_PORTAL.set_init_window(li)
init_window.mainloop
start()