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