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