在wxpython中创建子窗口
我正在使用 wxpython 创建一个程序,这需要为每个菜单栏项创建许多子窗口。我目前正在通过为每个子窗口编写不同的类定义并为每个事件实例化这些类来创建这些子窗口。这比拥有 wx.window 更好吗?两者如何比较以及它们应该在什么情况下使用?
I am creating a program using wxpython which entails the need to create many sub-windows for each of menubar items. I am currently creating those sub-windows by writing different class definition for each and instantiating those classes for each event. Is this better than to have wx.window? How does two compare and what are the situations where they should be used?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果每个工具栏项都是打开一个新的“窗口”,那么我会推荐wx.Frame或wx.Dialog。您几乎不需要直接使用 wx.Window。 wx.Window是wx.Frame和wx.Dialog的父级。因此,wx.Frame 和 wx.Dialog 可能会添加额外的功能。
对话框是模态的,当您希望在处理对话框时停止程序执行时(例如当您需要获取特殊信息来完成某些任务时),应该使用对话框。当不需要停止程序执行时使用帧。
If each toolbar item is to open a new "window", then I would recommend a wx.Frame or wx.Dialog. You almost never need to use wx.Window directly. wx.Window is the parent of wx.Frame and wx.Dialog. As such, wx.Frame and wx.Dialog potentially add additional functionality.
Dialogs are modal and should be used when you want program execution to stop while the dialog is dealt with (like when you need to get special information to complete some task). Frames are used when you don't need to stop program execution.