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