]> git.saurik.com Git - wxWidgets.git/blame - wxPython/demo/wxStaticText.py
Swtch to using Bind, and use better styles for the code viewer
[wxWidgets.git] / wxPython / demo / wxStaticText.py
CommitLineData
8fa876ca
RD
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#
cf694132 7
8fa876ca 8import wx
5fea3204 9
cf694132
RD
10#---------------------------------------------------------------------------
11
8fa876ca 12class TestPanel(wx.Panel):
cf694132 13 def __init__(self, parent):
8fa876ca 14 wx.Panel.__init__(self, parent, -1)
5fea3204 15
8fa876ca
RD
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))
5fea3204 18
8fa876ca
RD
19 wx.StaticText(
20 self, -1, "Is this yellow?", (20, 70), (90, -1)
21 ).SetBackgroundColour('Yellow')
cf694132 22
8fa876ca
RD
23 wx.StaticText(
24 self, -1, "align center", (120, 70), (90, -1), wx.ALIGN_CENTER
25 ).SetBackgroundColour('Yellow')
cf694132 26
8fa876ca
RD
27 wx.StaticText(
28 self, -1, "align right", (220, 70), (90, -1), wx.ALIGN_RIGHT
29 ).SetBackgroundColour('Yellow')
cf694132
RD
30
31 str = "This is a different font."
8fa876ca
RD
32 text = wx.StaticText(self, -1, str, (20, 100))
33 font = wx.Font(18, wx.SWISS, wx.NORMAL, wx.NORMAL)
cf694132 34 text.SetFont(font)
1fded56b 35 #text.SetSize(text.GetBestSize())
cf694132 36
8fa876ca
RD
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)
5fea3204 39
cf694132
RD
40
41#---------------------------------------------------------------------------
42
43def runTest(frame, nb, log):
44 panel = TestPanel(nb)
45 return panel
46
47
48#---------------------------------------------------------------------------
49
50
cf694132
RD
51overview = '''\
52A static text control displays one or more lines of read-only text.
53
cf694132
RD
54'''
55
5fea3204 56
5fea3204
RD
57if __name__ == '__main__':
58 import sys,os
59 import run
60 run.main(['', os.path.basename(sys.argv[0])])
61