]>
Commit | Line | Data |
---|---|---|
1 | ||
2 | import wx | |
3 | import images | |
4 | ||
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 | ||
16 | #---------------------------------------------------------------------- | |
17 | ||
18 | class 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 | ||
39 | def runTest(frame, nb, log): | |
40 | win = TestPanel(nb, log) | |
41 | return win | |
42 | ||
43 | #---------------------------------------------------------------------- | |
44 | ||
45 | overview = """\ | |
46 | A StaticBitmap control displays a bitmap. | |
47 | ||
48 | The bitmap to be displayed should have a small number of colours, such as 16, | |
49 | to avoid palette problems. | |
50 | ||
51 | A bitmap can be derived from most image formats using the wx.Image class. | |
52 | ||
53 | """ | |
54 | ||
55 | if __name__ == '__main__': | |
56 | import sys,os | |
57 | import run | |
58 | run.main(['', os.path.basename(sys.argv[0])] + sys.argv[1:]) |