]> git.saurik.com Git - wxWidgets.git/blame - wxPython/demo/wxStaticText.py
focus setting must be possible even when not shown yet
[wxWidgets.git] / wxPython / demo / wxStaticText.py
CommitLineData
cf694132
RD
1
2from wxPython.wx import *
3
1e4a197e 4USE_GENERIC = 0
5fea3204
RD
5
6if USE_GENERIC:
7 from wxPython.lib.stattext import wxGenStaticText as wxStaticText
8
cf694132
RD
9#---------------------------------------------------------------------------
10
11class TestPanel(wxPanel):
12 def __init__(self, parent):
13 wxPanel.__init__(self, parent, -1)
14
5fea3204
RD
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')
cf694132 20
5fea3204 21 wxStaticText(self, -1, "align center", (120, 70), (90, -1), wxALIGN_CENTER).SetBackgroundColour('Yellow')
cf694132 22
5fea3204 23 wxStaticText(self, -1, "align right", (220, 70), (90, -1), wxALIGN_RIGHT).SetBackgroundColour('Yellow')
cf694132
RD
24
25 str = "This is a different font."
5fea3204 26 text = wxStaticText(self, -1, str, (20, 100))
1fded56b 27 font = wxFont(18, wxSWISS, wxNORMAL, wxNORMAL)
cf694132 28 text.SetFont(font)
1fded56b 29 #text.SetSize(text.GetBestSize())
cf694132 30
5fea3204
RD
31 wxStaticText(self, -1, "Multi-line wxStaticText\nline 2\nline 3\n\nafter empty line", (20,150))
32 wxStaticText(self, -1, "Align right multi-line\nline 2\nline 3\n\nafter empty line", (220,150), style=wxALIGN_RIGHT)
33
cf694132
RD
34
35#---------------------------------------------------------------------------
36
37def runTest(frame, nb, log):
38 panel = TestPanel(nb)
39 return panel
40
41
42#---------------------------------------------------------------------------
43
44
45
cf694132
RD
46overview = '''\
47A static text control displays one or more lines of read-only text.
48
cf694132
RD
49'''
50
5fea3204
RD
51
52
53if __name__ == '__main__':
54 import sys,os
55 import run
56 run.main(['', os.path.basename(sys.argv[0])])
57