]> git.saurik.com Git - wxWidgets.git/blame - wxPython/samples/wxPIA_book/Chapter-01/hello.py
added missing button state
[wxWidgets.git] / wxPython / samples / wxPIA_book / Chapter-01 / hello.py
CommitLineData
be05b434
RD
1#!/usr/bin/env python
2
3"""Hello, wxPython! program."""
4
5import wx
6
7class Frame(wx.Frame):
8 """Frame class that displays an image."""
9
10 def __init__(self, image, parent=None, id=-1,
11 pos=wx.DefaultPosition, title='Hello, wxPython!'):
12 """Create a Frame instance and display image."""
13 temp = image.ConvertToBitmap()
14 size = temp.GetWidth(), temp.GetHeight()
15 wx.Frame.__init__(self, parent, id, title, pos, size)
16 panel = wx.Panel(self)
17 self.bmp = wx.StaticBitmap(parent=panel, bitmap=temp)
18 self.SetClientSize(size)
19
20class App(wx.App):
21 """Application class."""
22
23 def OnInit(self):
24 image = wx.Image('wxPython.jpg', wx.BITMAP_TYPE_JPEG)
25 self.frame = Frame(image)
26 self.frame.Show()
27 self.SetTopWindow(self.frame)
28 return True
29
30def main():
31 app = App()
32 app.MainLoop()
33
34if __name__ == '__main__':
35 main()
36