wxPython框架类和面板类的使用实例

作者:shichen2014 时间:2022-06-29 08:16:27 

本文实例讲述了wxPython框架类和面板类的使用方法,分享给大家供大家参考。具体分析如下:

实现代码如下:


import wx  

class MyApp(wx.App):  #自定义应用程序类,类中调用自定义的框架类
 def OnInit(self):
   self.frame = MyFrame(None, title = "My Main Frame jb51.net")
   self.SetTopWindow(self.frame)
   self.frame.Show()

return True

class MyFrame(wx.Frame): #自定义框架类,自定义的框架类中有一个panel的属性
 def __init__(self, parent, id=wx.ID_ANY, title=""):
   super(MyFrame, self).__init__(parent, id ,title)

# Attributes  
   self.panel = wx.Panel(self)

if __name__ == "__main__":
 app = MyApp()
 app.MainLoop()

程序运行效果如下图所示:

wxPython框架类和面板类的使用实例

希望本文所述对大家的Python程序设计有所帮助。

标签:wxPython
0
投稿

猜你喜欢

  • Golang 文件操作:删除指定的文件方式

    2024-03-28 16:39:11
  • 如何在网页上使用VBScript和JScript

    2008-05-05 19:53:00
  • python通过txt文件批量安装依赖包的实现步骤

    2022-05-10 23:26:14
  • sql server 复制表从一个数据库到另一个数据库

    2024-01-16 17:53:57
  • Pyinstaller+Pipenv打包Python文件的实现示例

    2021-06-11 01:49:51
  • Python 中的装饰器实现函数的缓存(场景分析)

    2022-07-30 01:37:08
  • Vue.js每天必学之过滤器与自定义过滤器

    2024-05-09 10:41:36
  • SecureCRTSecure7.0查看连接密码的步骤

    2021-01-28 07:34:14
  • oracle查看执行最慢与查询次数最多的sql语句

    2024-01-21 05:12:11
  • python3 unicode列表转换为中文的实例

    2021-02-13 20:06:06
  • django echarts饼图数据动态加载的实例

    2023-02-13 21:12:43
  • Python打印三角形九九乘法表代码

    2021-11-16 03:27:15
  • 交互设计实用指南系列(2) –可及

    2010-01-21 12:48:00
  • UTF-8 编码中BOM的检测与删除

    2022-06-04 07:44:16
  • go-cqhttp智能聊天功能的实现

    2024-04-26 17:30:53
  • Oracle 9i 数据库异常关闭后的启动

    2010-07-20 12:49:00
  • python中如何打包用户自定义模块

    2022-12-25 11:22:53
  • Mysql数据库百万级数据测试索引效果

    2024-01-24 01:30:03
  • Python正则替换字符串函数re.sub用法示例

    2021-03-04 17:25:42
  • HTML5本地存储初探(二)

    2010-03-07 15:47:00
  • asp之家 网络编程 m.aspxhome.com