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