#! /usr/bin/evn python # -*- coding:utf-8 -*- """hello .wxpython!program""" import wx class Frame(wx.Frame): """Frame class that dispalys an image.""" def __init__(self,image,parent=None,id=-1,pos=wx.DefaultPosition, title='游戏界面'): """Create a Frame instance and display image.""" temp=image.ConvertToBitmap() size=temp.GetWidth(),temp.GetHeight() wx.Frame.__init__(self,parent,id,title,pos,size) self.bmp=wx.StaticBitmap(parent=self,bitmap=temp) class App(wx.App): """Application class""" def OnInit(self): chance=int(raw_input('输入数字可以选择你要的图片:')) if 0==chance: image=wx.Image('1wxpython.jpg',wx.BITMAP_TYPE_JPEG) self.frame=Frame(image) self.frame.Show() self.SetTopWindow(self.frame) elif 1==chance: image2=wx.Image('2wxpython.jpg',wx.BITMAP_TYPE_JPEG) self.frame=Frame(image2) self.frame.Show() self.SetTopWindow(self.frame) elif 2==chance: image2=wx.Image('3wxpython.jpg',wx.BITMAP_TYPE_JPEG) self.frame=Frame(image2) self.frame.Show() self.SetTopWindow(self.frame) elif 3==chance: image2=wx.Image('4wxpython.jpg',wx.BITMAP_TYPE_JPEG) self.frame=Frame(image2) self.frame.Show() self.SetTopWindow(self.frame) elif 4==chance: image2=wx.Image('5wxpython.jpg',wx.BITMAP_TYPE_JPEG) self.frame=Frame(image2) self.frame.Show() self.SetTopWindow(self.frame) elif 5==chance: image2=wx.Image('6wxpython.jpg',wx.BITMAP_TYPE_JPEG) self.frame=Frame(image2) self.frame.Show() self.SetTopWindow(self.frame) return True def main(): app=App() app.MainLoop() if __name__=='__main__': main()
这个是一个简单的gui界面!
没有什么技术含量!