wxpython wx.AboutBox 单实例
我仍在学习更多有关 WxPython 的过程中,遇到了一个简单的问题。
我喜欢 wx.AboutBox 类,它管理如何向用户显示积分、许可和其他信息......而且我不期待从头开始构建自己的......尽管我可以。
这里的问题是,假设我单击一个按钮,弹出一个 AboutBox...似乎如果您继续单击该按钮,则会出现同一个 AboutBox 的多个实例...并且最终会出现多个窗口在我看来只是看起来很尴尬。据我研究...没有办法调用 ShowModal() 函数来获取 aboutbox 模板中关闭按钮的 ID 并进行一些处理确保只有一个实例正在运行。
我想知道如何阻止这个问题的发生...我想要一个 wx.AboutBox 的实例,如果由于它的性质/限制而无法使用此类,那么我将不得不考虑构建自己的实例作为最后一个采取。
谢谢
I'm still in the process of learning more about WxPython and I ran into a simple problem.
I like the wx.AboutBox class that manages how credits, licensing and other info is displayed to the user...and I'm not looking forward to building my own from scratch...although I can.
The problem here is that let's say I click on a button which brings up an AboutBox...seems like if you keep on clicking that exact button then multiple instances of the same AboutBox is brought up...and you end up multiple windows that just looks awkward in my opinion. As far as I've looked into it...there's no way to call the ShowModal() function that would allow you to get the ID of the close button in the aboutbox template and do some processing to make sure that only one instance is running.
I want to know how to stop this issue from happening...I want a single instance of wx.AboutBox and if it's not possible with this class due to it's nature/limitations then I'll have to consider building my own as a last resort.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
创建您自己的 AboutBox 对话框非常简单。这里有一篇文章展示了一种方法: http://www.blog.pythonlibrary.org/2008/06/11/wxpython-creating-an-about-box/ 或者您也可以使用 GenericMessageDialog。请参阅 wxPython 演示或 http://www.blog.pythonlibrary.org/2010/07/10/the-dialogs-of-wxpython-part-2-of-2/
Creating your own AboutBox dialog is pretty easy. Here's an article that shows one way to do it: http://www.blog.pythonlibrary.org/2008/06/11/wxpython-creating-an-about-box/ or you could just use a GenericMessageDialog too. See the wxPython demo or http://www.blog.pythonlibrary.org/2010/07/10/the-dialogs-of-wxpython-part-2-of-2/
看来你还没有解决这个问题。在wxPython中,有一个名为“SingleInstanceChecker”的类。我想这就是你要找的。
http://wxpython.org/Phoenix/docs/html/SingleInstanceChecker.html
It seems like you haven't solved this problem yet. In wxPython, there's a class called "SingleInstanceChecker". I think this is what you're looking for.
http://wxpython.org/Phoenix/docs/html/SingleInstanceChecker.html