简体   繁体   中英

wxPython: Minimize a Frame to tray

I am in the process of writing an app that I want to make a GUI for. I've got a little bit of experience with making GUI's in wxpython already, but one thing I have not had to try yet; is minimizing an application to tray. I have been doing my research and figured out how to make the icon, but what I have gotten stuck in the mud with is minimizing the Frame to the tray. I have found no functions that I can use to hide the frame with (wx.Frame.Hide() is not the answer). Do any of you know of any way that I could accomplish this? Thanks!

You need to look at the wxPython demo's source code. Look for the part which mentions the DemoTaskBarIcon. Then you'll want to bind to wx.EVT_ICONIZE. You do end up using the frame's Hide() method within the "iconize" event handler. How else would you hide it? Then to show it again, you'll want to use the menu from your task bar icon (which is technically a system tray icon on Windows). See also:

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM