]> git.saurik.com Git - wxWidgets.git/blob - wxPython/demo/StaticText.py
compilation fix for WXWIN_COMPATIBILITY_2_2 (bug 1252476)
[wxWidgets.git] / wxPython / demo / StaticText.py
1
2 import wx
3
4
5 USE_GENERIC = 0
6
7 if USE_GENERIC:
8 from wx.lib.stattext import GenStaticText as StaticText
9 else:
10 StaticText = wx.StaticText
11
12
13 #---------------------------------------------------------------------------
14
15 class TestPanel(wx.Panel):
16 def __init__(self, parent):
17 wx.Panel.__init__(self, parent, -1)
18 ##self.SetBackgroundColour("sky blue")
19
20 StaticText(self, -1, "This is an example of static text", (20, 10))
21 StaticText(self, -1, "using the wx.StaticText Control.", (20, 30))
22
23 StaticText(
24 self, -1, "Is this yellow?", (20, 70), (120, -1)
25 ).SetBackgroundColour('Yellow')
26
27 StaticText(
28 self, -1, "align center", (160, 70), (120, -1), wx.ALIGN_CENTER
29 ).SetBackgroundColour('Yellow')
30
31 StaticText(
32 self, -1, "align right", (300, 70), (120, -1), wx.ALIGN_RIGHT
33 ).SetBackgroundColour('Yellow')
34
35 str = "This is a different font."
36 text = StaticText(self, -1, str, (20, 120))
37 font = wx.Font(18, wx.SWISS, wx.NORMAL, wx.NORMAL)
38 text.SetFont(font)
39
40 StaticText(self, -1,
41 "Multi-line wx.StaticText\nline 2\nline 3\n\nafter empty line",
42 (20,170))
43 StaticText(self, -1,
44 "Align right multi-line\nline 2\nline 3\n\nafter empty line",
45 (220,170), style=wx.ALIGN_RIGHT)
46
47
48 #---------------------------------------------------------------------------
49
50 def runTest(frame, nb, log):
51 panel = TestPanel(nb)
52 return panel
53
54
55 #---------------------------------------------------------------------------
56
57
58 overview = '''\
59 A StaticText control displays one or more lines of read-only text.
60
61 '''
62
63
64 if __name__ == '__main__':
65 import sys,os
66 import run
67 run.main(['', os.path.basename(sys.argv[0])] + sys.argv[1:])
68