最简单的wxPython程序
#
coding:gb2312
# FileName wxFrame.pyw wxPython 演示
import os
import wx
class Frame(wx.Frame):
def __init__ (self):
wx.Frame. __init__ (self, None, - 1 , title = " Hello wxFrame.我的 wxPython. " ,pos = ( 350 , 200 ), size = ( 300 , 300 ))
# 程序icon图标
icon = wx.EmptyIcon()
icon.LoadFile( os.path.abspath( " qq.ico " ),wx.BITMAP_TYPE_ICO)
self.SetIcon(icon)
# 框架背景
image = wx.Image( os.path.abspath( " wxbg.gif " ),wx.BITMAP_TYPE_GIF)
tImage = image.ConvertToBitmap()
self.bmp = wx.StaticBitmap(parent = self, bitmap = tImage)
class App(wx.App):
def OnInit (self):
frame = Frame()
frame.Show(True)
return True
# ----------------------------------------------------------------------
# ----------------------------------------------------------------------
if __name__ == ' __main__ ' :
app = App()
app.MainLoop()
# FileName wxFrame.pyw wxPython 演示
import os
import wx
class Frame(wx.Frame):
def __init__ (self):
wx.Frame. __init__ (self, None, - 1 , title = " Hello wxFrame.我的 wxPython. " ,pos = ( 350 , 200 ), size = ( 300 , 300 ))
# 程序icon图标
icon = wx.EmptyIcon()
icon.LoadFile( os.path.abspath( " qq.ico " ),wx.BITMAP_TYPE_ICO)
self.SetIcon(icon)
# 框架背景
image = wx.Image( os.path.abspath( " wxbg.gif " ),wx.BITMAP_TYPE_GIF)
tImage = image.ConvertToBitmap()
self.bmp = wx.StaticBitmap(parent = self, bitmap = tImage)
class App(wx.App):
def OnInit (self):
frame = Frame()
frame.Show(True)
return True
# ----------------------------------------------------------------------
# ----------------------------------------------------------------------
if __name__ == ' __main__ ' :
app = App()
app.MainLoop()