wxPython:最小化一个框架到托盘 [英] wxPython: Minimize a Frame to tray

查看:30
本文介绍了wxPython:最小化一个框架到托盘的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写我想为其制作 GUI 的应用程序.我已经有一些在 wxpython 中制作 GUI 的经验,但有一件事我还没有尝试过;正在最小化托盘的应用程序.我一直在做我的研究并想出了如何制作图标,但我陷入困境的是将框架最小化到托盘.我没有发现可以用来隐藏框架的函数(wx.Frame.Hide() 不是答案).你们中有人知道我可以通过什么方式完成此任务吗?谢谢!

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!

推荐答案

需要看wxPython demo的源码.查找提到 DemoTaskBarIcon 的部分.然后你会想要绑定到 wx.EVT_ICONIZE.您最终会在iconize"事件处理程序中使用框架的 Hide() 方法.不然怎么隐藏?然后要再次显示它,您需要使用任务栏图标(从技术上讲是 Windows 上的系统托盘图标)中的菜单.另见:

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:

这篇关于wxPython:最小化一个框架到托盘的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆