English 中文(简体)
为什么我的前男友消失 当它最小化于PyInstaller之后
原标题:Why my exe disappear when it minimize after pyInstaller
When testing the code in the console it runs normally and all the functions work properly and after pyInstaller the problem comes. When I press the Minimize button, instead of appearing in the system tray, the icon disappears and in general the program is not in a window, but it works in the background? If anyone can help :) I only tried with update pyInstaller and pystray, have no Idea what to do.. # -*- mode: python ; coding: utf-8 -*- a = Analysis( [ web_search.py ], pathex=[], binaries=[], datas=[( ImotSearch_MIcon.png , . ), ( sent_ads.json , web )], hiddenimports=[ requests , pystray ], hookspath=[], hooksconfig={}, runtime_hooks=[], excludes=[], noarchive=True, optimize=0, ) pyz = PYZ(a.pure) exe = EXE( pyz, a.scripts, a.binaries, a.datas, [( v , None, OPTION )], name= web_search , debug=True, bootloader_ignore_signals=False, strip=False, upx=True, upx_exclude=[], runtime_tmpdir=None, console=False, disable_windowed_traceback=False, argv_emulation=False, target_arch=None, codesign_identity=None, entitlements_file=None, icon=[ ImotSearch_MIcon.png ], )` button: def quit_window(icon, item): icon.stop() root.destroy() def show_window(icon, item): icon.stop() root.after(0, root.deiconify) def hide_window(): root.withdraw() image = Image.open(r"ImotSearch_MIcon.png") menu = (item( Exit , quit_window), item( Open , show_window)) icon = pystray.Icon("name", image, "web search", menu) icon.run() minimize_button = tk.Button(root, text="Minimize", command=hide_window) minimize_button.pack(pady=5)````
问题回答
Most likely antivirus is deleting the executable. If it is the case then you may able to restore your AV s quarantine list.
The problem turned out to be entirely me. Here is a working version: def hide_window(self): self.withdraw() self.tray_thread = Thread(target=self.create_tray_icon) self.tray_thread.daemon = True self.tray_thread.start() def show_window(self): self.deiconify() # Показва прозорец




相关问题
Can Django models use MySQL functions?

Is there a way to force Django models to pass a field to a MySQL function every time the model data is read or loaded? To clarify what I mean in SQL, I want the Django model to produce something like ...

An enterprise scheduler for python (like quartz)

I am looking for an enterprise tasks scheduler for python, like quartz is for Java. Requirements: Persistent: if the process restarts or the machine restarts, then all the jobs must stay there and ...

How to remove unique, then duplicate dictionaries in a list?

Given the following list that contains some duplicate and some unique dictionaries, what is the best method to remove unique dictionaries first, then reduce the duplicate dictionaries to single ...

What is suggested seed value to use with random.seed()?

Simple enough question: I m using python random module to generate random integers. I want to know what is the suggested value to use with the random.seed() function? Currently I am letting this ...

How can I make the PyDev editor selectively ignore errors?

I m using PyDev under Eclipse to write some Jython code. I ve got numerous instances where I need to do something like this: import com.work.project.component.client.Interface.ISubInterface as ...

How do I profile `paster serve` s startup time?

Python s paster serve app.ini is taking longer than I would like to be ready for the first request. I know how to profile requests with middleware, but how do I profile the initialization time? I ...

Pragmatically adding give-aways/freebies to an online store

Our business currently has an online store and recently we ve been offering free specials to our customers. Right now, we simply display the special and give the buyer a notice stating we will add the ...

Converting Dictionary to List? [duplicate]

I m trying to convert a Python dictionary into a Python list, in order to perform some calculations. #My dictionary dict = {} dict[ Capital ]="London" dict[ Food ]="Fish&Chips" dict[ 2012 ]="...

热门标签