]>
git.saurik.com Git - wxWidgets.git/blob - wxPython/demo/wxStaticText.py
2 from wxPython
.wx
import *
7 from wxPython
.lib
.stattext
import wxGenStaticText
as wxStaticText
9 #---------------------------------------------------------------------------
11 class TestPanel(wxPanel
):
12 def __init__(self
, parent
):
13 wxPanel
.__init
__(self
, parent
, -1)
15 wxStaticText(self
, -1, "This is an example of static text", (20, 10))
17 wxStaticText(self
, -1, "using the wxStaticText Control.", (20, 30))
19 wxStaticText(self
, -1, "Is this yellow?", (20, 70), (90, -1)).SetBackgroundColour('Yellow')
21 wxStaticText(self
, -1, "align center", (120, 70), (90, -1), wxALIGN_CENTER
).SetBackgroundColour('Yellow')
23 wxStaticText(self
, -1, "align right", (220, 70), (90, -1), wxALIGN_RIGHT
).SetBackgroundColour('Yellow')
25 str = "This is a different font."
26 text
= wxStaticText(self
, -1, str, (20, 100))
27 font
= wxFont(18, wxSWISS
, wxNORMAL
, wxNORMAL
, False, "Arial")
28 w
, h
, d
, e
= self
.GetFullTextExtent(str, font
)
30 text
.SetSize(wxSize(w
, h
))
32 wxStaticText(self
, -1, "Multi-line wxStaticText\nline 2\nline 3\n\nafter empty line", (20,150))
33 wxStaticText(self
, -1, "Align right multi-line\nline 2\nline 3\n\nafter empty line", (220,150), style
=wxALIGN_RIGHT
)
36 #---------------------------------------------------------------------------
38 def runTest(frame
, nb
, log
):
43 #---------------------------------------------------------------------------
48 A static text control displays one or more lines of read-only text.
54 if __name__
== '__main__':
57 run
.main(['', os
.path
.basename(sys
.argv
[0])])