]> git.saurik.com Git - wxWidgets.git/blame_incremental - wxPython/demo/StaticBitmap.py
fixed compile error
[wxWidgets.git] / wxPython / demo / StaticBitmap.py
... / ...
CommitLineData
1
2import wx
3import images
4
5
6USE_GENERIC = 0
7
8if USE_GENERIC:
9 from wx.lib.stattext import GenStaticText as StaticText
10 from wx.lib.statbmp import GenStaticBitmap as StaticBitmap
11else:
12 StaticText = wx.StaticText
13 StaticBitmap = wx.StaticBitmap
14
15
16#----------------------------------------------------------------------
17
18class TestPanel(wx.Panel):
19 def __init__(self, parent, log):
20 wx.Panel.__init__(self, parent, -1)
21 self.log = log
22 ##self.SetBackgroundColour("sky blue")
23
24 StaticText(self, -1, "This is a wx.StaticBitmap.", (45, 15))
25
26 bmp = images.getTest2Bitmap()
27 mask = wx.Mask(bmp, wx.BLUE)
28 bmp.SetMask(mask)
29 StaticBitmap(self, -1, bmp, (80, 50), (bmp.GetWidth(), bmp.GetHeight()))
30
31 bmp = images.getRobinBitmap()
32 StaticBitmap(self, -1, bmp, (80, 150))
33
34 StaticText(self, -1, "Hey, if Ousterhout can do it, so can I.", (200, 175))
35
36
37#----------------------------------------------------------------------
38
39def runTest(frame, nb, log):
40 win = TestPanel(nb, log)
41 return win
42
43#----------------------------------------------------------------------
44
45overview = """\
46A StaticBitmap control displays a bitmap.
47
48The bitmap to be displayed should have a small number of colours, such as 16,
49to avoid palette problems.
50
51A bitmap can be derived from most image formats using the wx.Image class.
52
53"""
54
55if __name__ == '__main__':
56 import sys,os
57 import run
58 run.main(['', os.path.basename(sys.argv[0])] + sys.argv[1:])