]>
Commit | Line | Data |
---|---|---|
1 | #!/usr/bin/env python | |
2 | ||
3 | """Hello, wxPython! program.""" | |
4 | ||
5 | __author__ = "Patrick K. O'Brien <pobrien@orbtech.com>" | |
6 | __cvsid__ = "$Id$" | |
7 | __revision__ = "$Revision$"[11:-2] | |
8 | ||
9 | import wx | |
10 | ||
11 | class Frame(wx.Frame): | |
12 | """Frame class that displays an image.""" | |
13 | ||
14 | def __init__(self, image, parent=None, id=-1, | |
15 | pos=wx.DefaultPosition, title='Hello, wxPython!'): | |
16 | """Create a Frame instance and display image.""" | |
17 | temp = image.ConvertToBitmap() | |
18 | size = temp.GetWidth(), temp.GetHeight() | |
19 | wx.Frame.__init__(self, parent, id, title, pos, size) | |
20 | self.bmp = wx.StaticBitmap(parent=self, id=-1, bitmap=temp) | |
21 | ||
22 | class App(wx.App): | |
23 | """Application class.""" | |
24 | ||
25 | def OnInit(self): | |
26 | wx.InitAllImageHandlers() | |
27 | image = wx.Image('wxPython.jpg', wx.BITMAP_TYPE_JPEG) | |
28 | self.frame = Frame(image) | |
29 | self.frame.Show() | |
30 | self.SetTopWindow(self.frame) | |
31 | return True | |
32 | ||
33 | def main(): | |
34 | app = App() | |
35 | app.MainLoop() | |
36 | ||
37 | if __name__ == '__main__': | |
38 | main() |