]>
Commit | Line | Data |
---|---|---|
cf694132 | 1 | |
8fa876ca | 2 | import wx |
5fea3204 | 3 | |
cf694132 RD |
4 | #--------------------------------------------------------------------------- |
5 | ||
8fa876ca | 6 | class TestPanel(wx.Panel): |
cf694132 | 7 | def __init__(self, parent): |
8fa876ca | 8 | wx.Panel.__init__(self, parent, -1) |
5fea3204 | 9 | |
8fa876ca | 10 | wx.StaticText(self, -1, "This is an example of static text", (20, 10)) |
95bfd958 | 11 | wx.StaticText(self, -1, "using the wx.StaticText Control.", (20, 30)) |
5fea3204 | 12 | |
8fa876ca RD |
13 | wx.StaticText( |
14 | self, -1, "Is this yellow?", (20, 70), (90, -1) | |
15 | ).SetBackgroundColour('Yellow') | |
cf694132 | 16 | |
8fa876ca RD |
17 | wx.StaticText( |
18 | self, -1, "align center", (120, 70), (90, -1), wx.ALIGN_CENTER | |
19 | ).SetBackgroundColour('Yellow') | |
cf694132 | 20 | |
8fa876ca RD |
21 | wx.StaticText( |
22 | self, -1, "align right", (220, 70), (90, -1), wx.ALIGN_RIGHT | |
23 | ).SetBackgroundColour('Yellow') | |
cf694132 RD |
24 | |
25 | str = "This is a different font." | |
8fa876ca RD |
26 | text = wx.StaticText(self, -1, str, (20, 100)) |
27 | font = wx.Font(18, wx.SWISS, wx.NORMAL, wx.NORMAL) | |
cf694132 | 28 | text.SetFont(font) |
1fded56b | 29 | #text.SetSize(text.GetBestSize()) |
cf694132 | 30 | |
95bfd958 | 31 | wx.StaticText(self, -1, "Multi-line wx.StaticText\nline 2\nline 3\n\nafter empty line", (20,150)) |
8fa876ca | 32 | wx.StaticText(self, -1, "Align right multi-line\nline 2\nline 3\n\nafter empty line", (220,150), style=wx.ALIGN_RIGHT) |
5fea3204 | 33 | |
cf694132 RD |
34 | |
35 | #--------------------------------------------------------------------------- | |
36 | ||
37 | def runTest(frame, nb, log): | |
38 | panel = TestPanel(nb) | |
39 | return panel | |
40 | ||
41 | ||
42 | #--------------------------------------------------------------------------- | |
43 | ||
44 | ||
cf694132 | 45 | overview = '''\ |
95bfd958 | 46 | A StaticText control displays one or more lines of read-only text. |
cf694132 | 47 | |
cf694132 RD |
48 | ''' |
49 | ||
5fea3204 | 50 | |
5fea3204 RD |
51 | if __name__ == '__main__': |
52 | import sys,os | |
53 | import run | |
54 | run.main(['', os.path.basename(sys.argv[0])]) | |
55 |