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