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