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