Added the sample code from wxPython In Action to the samples dir
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@42925 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
38
wxPython/samples/wxPIA_book/Chapter-07/static_text.py
Normal file
38
wxPython/samples/wxPIA_book/Chapter-07/static_text.py
Normal file
@@ -0,0 +1,38 @@
|
||||
import wx
|
||||
|
||||
class StaticTextFrame(wx.Frame):
|
||||
def __init__(self):
|
||||
wx.Frame.__init__(self, None, -1, 'Static Text Example',
|
||||
size=(400, 300))
|
||||
panel = wx.Panel(self, -1)
|
||||
wx.StaticText(panel, -1, "This is an example of static text",
|
||||
(100, 10))
|
||||
rev = wx.StaticText(panel, -1, "Static Text With Reversed Colors",
|
||||
(100, 30))
|
||||
rev.SetForegroundColour('white')
|
||||
rev.SetBackgroundColour('black')
|
||||
center = wx.StaticText(panel, -1, "align center", (100, 50),
|
||||
(160, -1), wx.ALIGN_CENTER)
|
||||
center.SetForegroundColour('white')
|
||||
center.SetBackgroundColour('black')
|
||||
right = wx.StaticText(panel, -1, "align right", (100, 70),
|
||||
(160, -1), wx.ALIGN_RIGHT)
|
||||
right.SetForegroundColour('white')
|
||||
right.SetBackgroundColour('black')
|
||||
str = "You can also change the font."
|
||||
text = wx.StaticText(panel, -1, str, (20, 100))
|
||||
font = wx.Font(18, wx.DECORATIVE, wx.ITALIC, wx.NORMAL)
|
||||
text.SetFont(font)
|
||||
wx.StaticText(panel, -1, "Your text\ncan be split\n"
|
||||
"over multiple lines\n\neven blank ones", (20,150))
|
||||
wx.StaticText(panel, -1, "Multi-line text\ncan also\n"
|
||||
"be right aligned\n\neven with a blank", (220,150),
|
||||
style=wx.ALIGN_RIGHT)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
app = wx.PySimpleApp()
|
||||
frame = StaticTextFrame()
|
||||
frame.Show()
|
||||
app.MainLoop()
|
||||
|
Reference in New Issue
Block a user