]> git.saurik.com Git - wxWidgets.git/blob - wxPython/samples/wxPIA_book/Chapter-07/static_text.py
fix building/running of tex2rtf
[wxWidgets.git] / wxPython / samples / wxPIA_book / Chapter-07 / static_text.py
1 import wx
2
3 class StaticTextFrame(wx.Frame):
4 def __init__(self):
5 wx.Frame.__init__(self, None, -1, 'Static Text Example',
6 size=(400, 300))
7 panel = wx.Panel(self, -1)
8 wx.StaticText(panel, -1, "This is an example of static text",
9 (100, 10))
10 rev = wx.StaticText(panel, -1, "Static Text With Reversed Colors",
11 (100, 30))
12 rev.SetForegroundColour('white')
13 rev.SetBackgroundColour('black')
14 center = wx.StaticText(panel, -1, "align center", (100, 50),
15 (160, -1), wx.ALIGN_CENTER)
16 center.SetForegroundColour('white')
17 center.SetBackgroundColour('black')
18 right = wx.StaticText(panel, -1, "align right", (100, 70),
19 (160, -1), wx.ALIGN_RIGHT)
20 right.SetForegroundColour('white')
21 right.SetBackgroundColour('black')
22 str = "You can also change the font."
23 text = wx.StaticText(panel, -1, str, (20, 100))
24 font = wx.Font(18, wx.DECORATIVE, wx.ITALIC, wx.NORMAL)
25 text.SetFont(font)
26 wx.StaticText(panel, -1, "Your text\ncan be split\n"
27 "over multiple lines\n\neven blank ones", (20,150))
28 wx.StaticText(panel, -1, "Multi-line text\ncan also\n"
29 "be right aligned\n\neven with a blank", (220,150),
30 style=wx.ALIGN_RIGHT)
31
32
33 if __name__ == '__main__':
34 app = wx.PySimpleApp()
35 frame = StaticTextFrame()
36 frame.Show()
37 app.MainLoop()
38