]>
Commit | Line | Data |
---|---|---|
1 | ||
2 | from wxPython.wx import * | |
3 | ||
4 | USE_GENERIC = 0 | |
5 | ||
6 | if USE_GENERIC: | |
7 | from wxPython.lib.stattext import wxGenStaticText as wxStaticText | |
8 | ||
9 | #--------------------------------------------------------------------------- | |
10 | ||
11 | class 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) | |
28 | text.SetFont(font) | |
29 | #text.SetSize(text.GetBestSize()) | |
30 | ||
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 | ||
34 | ||
35 | #--------------------------------------------------------------------------- | |
36 | ||
37 | def runTest(frame, nb, log): | |
38 | panel = TestPanel(nb) | |
39 | return panel | |
40 | ||
41 | ||
42 | #--------------------------------------------------------------------------- | |
43 | ||
44 | ||
45 | ||
46 | overview = '''\ | |
47 | A static text control displays one or more lines of read-only text. | |
48 | ||
49 | ''' | |
50 | ||
51 | ||
52 | ||
53 | if __name__ == '__main__': | |
54 | import sys,os | |
55 | import run | |
56 | run.main(['', os.path.basename(sys.argv[0])]) | |
57 |