1999-04-29 23:29:54 -04:00
|
|
|
|
2003-12-08 20:23:28 -05:00
|
|
|
import wx
|
2002-07-08 16:06:13 -04:00
|
|
|
|
2004-05-01 22:41:33 -04:00
|
|
|
|
|
|
|
USE_GENERIC = 0
|
2004-05-14 17:22:39 -04:00
|
|
|
|
2004-05-01 22:41:33 -04:00
|
|
|
if USE_GENERIC:
|
|
|
|
from wx.lib.stattext import GenStaticText as StaticText
|
|
|
|
else:
|
|
|
|
StaticText = wx.StaticText
|
|
|
|
|
|
|
|
|
1999-04-29 23:29:54 -04:00
|
|
|
#---------------------------------------------------------------------------
|
|
|
|
|
2003-12-08 20:23:28 -05:00
|
|
|
class TestPanel(wx.Panel):
|
1999-04-29 23:29:54 -04:00
|
|
|
def __init__(self, parent):
|
2003-12-08 20:23:28 -05:00
|
|
|
wx.Panel.__init__(self, parent, -1)
|
2004-05-14 17:22:39 -04:00
|
|
|
##self.SetBackgroundColour("sky blue")
|
2002-07-08 16:06:13 -04:00
|
|
|
|
2004-05-01 22:41:33 -04:00
|
|
|
StaticText(self, -1, "This is an example of static text", (20, 10))
|
|
|
|
StaticText(self, -1, "using the wx.StaticText Control.", (20, 30))
|
2002-07-08 16:06:13 -04:00
|
|
|
|
2004-05-01 22:41:33 -04:00
|
|
|
StaticText(
|
2004-05-14 17:22:39 -04:00
|
|
|
self, -1, "Is this yellow?", (20, 70), (120, -1)
|
2003-12-08 20:23:28 -05:00
|
|
|
).SetBackgroundColour('Yellow')
|
1999-04-29 23:29:54 -04:00
|
|
|
|
2004-05-01 22:41:33 -04:00
|
|
|
StaticText(
|
2004-05-14 17:22:39 -04:00
|
|
|
self, -1, "align center", (160, 70), (120, -1), wx.ALIGN_CENTER
|
2003-12-08 20:23:28 -05:00
|
|
|
).SetBackgroundColour('Yellow')
|
1999-04-29 23:29:54 -04:00
|
|
|
|
2004-05-01 22:41:33 -04:00
|
|
|
StaticText(
|
2004-05-14 17:22:39 -04:00
|
|
|
self, -1, "align right", (300, 70), (120, -1), wx.ALIGN_RIGHT
|
2003-12-08 20:23:28 -05:00
|
|
|
).SetBackgroundColour('Yellow')
|
1999-04-29 23:29:54 -04:00
|
|
|
|
|
|
|
str = "This is a different font."
|
2004-05-14 17:22:39 -04:00
|
|
|
text = StaticText(self, -1, str, (20, 120))
|
2003-12-08 20:23:28 -05:00
|
|
|
font = wx.Font(18, wx.SWISS, wx.NORMAL, wx.NORMAL)
|
1999-04-29 23:29:54 -04:00
|
|
|
text.SetFont(font)
|
2004-04-24 20:39:05 -04:00
|
|
|
text.SetSize(text.GetBestSize())
|
1999-04-29 23:29:54 -04:00
|
|
|
|
2004-05-14 17:22:39 -04:00
|
|
|
StaticText(self, -1,
|
|
|
|
"Multi-line wx.StaticText\nline 2\nline 3\n\nafter empty line",
|
|
|
|
(20,170))
|
|
|
|
StaticText(self, -1,
|
|
|
|
"Align right multi-line\nline 2\nline 3\n\nafter empty line",
|
|
|
|
(220,170), style=wx.ALIGN_RIGHT)
|
2002-07-08 16:06:13 -04:00
|
|
|
|
1999-04-29 23:29:54 -04:00
|
|
|
|
|
|
|
#---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
def runTest(frame, nb, log):
|
|
|
|
panel = TestPanel(nb)
|
|
|
|
return panel
|
|
|
|
|
|
|
|
|
|
|
|
#---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
overview = '''\
|
2004-01-12 22:17:17 -05:00
|
|
|
A StaticText control displays one or more lines of read-only text.
|
1999-04-29 23:29:54 -04:00
|
|
|
|
|
|
|
'''
|
|
|
|
|
2002-07-08 16:06:13 -04:00
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
import sys,os
|
|
|
|
import run
|
2004-03-04 19:06:33 -05:00
|
|
|
run.main(['', os.path.basename(sys.argv[0])] + sys.argv[1:])
|
2002-07-08 16:06:13 -04:00
|
|
|
|