]> git.saurik.com Git - wxWidgets.git/blob - wxPython/demo/wxStaticText.py
Track and translate typenames where possible
[wxWidgets.git] / wxPython / demo / wxStaticText.py
1 # 11/21/2003 - Jeff Grimmett (grimmtooth@softhome.net)
2 #
3 # o Updated for wx namespace
4 # o Removed the USE_GENERIC code because it doesn't work unless you use
5 # the 'from wx import *' methodology.
6 #
7
8 import wx
9
10 #---------------------------------------------------------------------------
11
12 class TestPanel(wx.Panel):
13 def __init__(self, parent):
14 wx.Panel.__init__(self, parent, -1)
15
16 wx.StaticText(self, -1, "This is an example of static text", (20, 10))
17 wx.StaticText(self, -1, "using the wxStaticText Control.", (20, 30))
18
19 wx.StaticText(
20 self, -1, "Is this yellow?", (20, 70), (90, -1)
21 ).SetBackgroundColour('Yellow')
22
23 wx.StaticText(
24 self, -1, "align center", (120, 70), (90, -1), wx.ALIGN_CENTER
25 ).SetBackgroundColour('Yellow')
26
27 wx.StaticText(
28 self, -1, "align right", (220, 70), (90, -1), wx.ALIGN_RIGHT
29 ).SetBackgroundColour('Yellow')
30
31 str = "This is a different font."
32 text = wx.StaticText(self, -1, str, (20, 100))
33 font = wx.Font(18, wx.SWISS, wx.NORMAL, wx.NORMAL)
34 text.SetFont(font)
35 #text.SetSize(text.GetBestSize())
36
37 wx.StaticText(self, -1, "Multi-line wxStaticText\nline 2\nline 3\n\nafter empty line", (20,150))
38 wx.StaticText(self, -1, "Align right multi-line\nline 2\nline 3\n\nafter empty line", (220,150), style=wx.ALIGN_RIGHT)
39
40
41 #---------------------------------------------------------------------------
42
43 def runTest(frame, nb, log):
44 panel = TestPanel(nb)
45 return panel
46
47
48 #---------------------------------------------------------------------------
49
50
51 overview = '''\
52 A static text control displays one or more lines of read-only text.
53
54 '''
55
56
57 if __name__ == '__main__':
58 import sys,os
59 import run
60 run.main(['', os.path.basename(sys.argv[0])])
61