博客记事

来源:互联网 发布:glide加载网络图片 编辑:程序博客网 时间:2024/04/19 09:58
暑假在家没有网,自己在家里练习了很多东西,把所有的东西一次发上来!
#! /usr/bin/evn python# -*- coding:utf-8 -*-"""hello .wxpython!program"""import wxclass 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 Truedef main():    app=App()    app.MainLoop()if __name__=='__main__':    main()

这个是一个简单的gui界面!


没有什么技术含量!