🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
Panel是窗口的容器,通常其大小与Frame一样,在其上放置各种控件,这样可将窗口内容与工具栏及状态栏区分开,能过TAB键可遍历Panel中的元素,直接看个例子: ~~~ #!/usr/bin/env python # -*- coding: utf-8 -*- import wx class MyFrame(wx.Frame): def __init__(self, parent, id): wx.Frame.__init__(self, parent, id, u'测试面板Panel', size = (600, 300)) #创建面板 panel = wx.Panel(self) #在Panel上添加Button button = wx.Button(panel, label = u'关闭', pos = (150, 60), size = (100, 60)) #绑定单击事件 self.Bind(wx.EVT_BUTTON, self.OnCloseMe, button) def OnCloseMe(self, event): self.Close(True) if __name__ == '__main__': app = wx.PySimpleApp() frame = MyFrame(parent = None, id = -1) frame.Show() app.MainLoop() ~~~ 测试: ![](https://box.kancloud.cn/2016-06-08_5757935ece140.png)