1999-04-30 03:29:54 +00:00
|
|
|
|
2003-12-09 01:23:28 +00:00
|
|
|
import wx
|
2002-07-08 20:06:13 +00:00
|
|
|
|
2004-05-02 02:41:33 +00:00
|
|
|
|
|
|
|
USE_GENERIC = 0
|
2004-05-14 21:22:39 +00:00
|
|
|
|
2004-05-02 02:41:33 +00:00
|
|
|
if USE_GENERIC:
|
|
|
|
from wx.lib.stattext import GenStaticText as StaticText
|
|
|
|
else:
|
|
|
|
StaticText = wx.StaticText
|
|
|
|
|
|
|
|
|
1999-04-30 03:29:54 +00:00
|
|
|
#---------------------------------------------------------------------------
|
|
|
|
|
2003-12-09 01:23:28 +00:00
|
|
|
class TestPanel(wx.Panel):
|
1999-04-30 03:29:54 +00:00
|
|
|
def __init__(self, parent):
|
2003-12-09 01:23:28 +00:00
|
|
|
wx.Panel.__init__(self, parent, -1)
|
2004-05-14 21:22:39 +00:00
|
|
|
##self.SetBackgroundColour("sky blue")
|
2002-07-08 20:06:13 +00:00
|
|
|
|
2004-05-02 02:41:33 +00: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 20:06:13 +00:00
|
|
|
|
2004-05-02 02:41:33 +00:00
|
|
|
StaticText(
|
2004-05-14 21:22:39 +00:00
|
|
|
self, -1, "Is this yellow?", (20, 70), (120, -1)
|
2003-12-09 01:23:28 +00:00
|
|
|
).SetBackgroundColour('Yellow')
|
1999-04-30 03:29:54 +00:00
|
|
|
|
2004-05-02 02:41:33 +00:00
|
|
|
StaticText(
|
2004-05-14 21:22:39 +00:00
|
|
|
self, -1, "align center", (160, 70), (120, -1), wx.ALIGN_CENTER
|
2003-12-09 01:23:28 +00:00
|
|
|
).SetBackgroundColour('Yellow')
|
1999-04-30 03:29:54 +00:00
|
|
|
|
2004-05-02 02:41:33 +00:00
|
|
|
StaticText(
|
2004-05-14 21:22:39 +00:00
|
|
|
self, -1, "align right", (300, 70), (120, -1), wx.ALIGN_RIGHT
|
2003-12-09 01:23:28 +00:00
|
|
|
).SetBackgroundColour('Yellow')
|
1999-04-30 03:29:54 +00:00
|
|
|
|
|
|
|
str = "This is a different font."
|
2004-05-14 21:22:39 +00:00
|
|
|
text = StaticText(self, -1, str, (20, 120))
|
2003-12-09 01:23:28 +00:00
|
|
|
font = wx.Font(18, wx.SWISS, wx.NORMAL, wx.NORMAL)
|
1999-04-30 03:29:54 +00:00
|
|
|
text.SetFont(font)
|
|
|
|
|
2004-05-14 21:22:39 +00: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 20:06:13 +00:00
|
|
|
|
1999-04-30 03:29:54 +00:00
|
|
|
|
|
|
|
#---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
def runTest(frame, nb, log):
|
|
|
|
panel = TestPanel(nb)
|
|
|
|
return panel
|
|
|
|
|
|
|
|
|
|
|
|
#---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
overview = '''\
|
2004-01-13 03:17:17 +00:00
|
|
|
A StaticText control displays one or more lines of read-only text.
|
1999-04-30 03:29:54 +00:00
|
|
|
|
|
|
|
'''
|
|
|
|
|
2002-07-08 20:06:13 +00:00
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
import sys,os
|
|
|
|
import run
|
2004-03-05 00:06:33 +00:00
|
|
|
run.main(['', os.path.basename(sys.argv[0])] + sys.argv[1:])
|
2002-07-08 20:06:13 +00:00
|
|
|
|