]> git.saurik.com Git - wxWidgets.git/blob - wxPython/samples/wxPIA_book/Chapter-07/text_ctrl_multiple.py
fix building/running of tex2rtf
[wxWidgets.git] / wxPython / samples / wxPIA_book / Chapter-07 / text_ctrl_multiple.py
1 import wx
2
3 class TextFrame(wx.Frame):
4
5 def __init__(self):
6 wx.Frame.__init__(self, None, -1, 'Text Entry Example',
7 size=(300, 250))
8 panel = wx.Panel(self, -1)
9 multiLabel = wx.StaticText(panel, -1, "Multi-line")
10 multiText = wx.TextCtrl(panel, -1,
11 "Here is a looooooooooooooong line of text set in the control.\n\n"
12 "See that it wrapped, and that this line is after a blank",
13 size=(200, 100), style=wx.TE_MULTILINE)
14 multiText.SetInsertionPoint(0)
15
16 richLabel = wx.StaticText(panel, -1, "Rich Text")
17 richText = wx.TextCtrl(panel, -1,
18 "If supported by the native control, this is reversed, and this is a different font.",
19 size=(200, 100), style=wx.TE_MULTILINE|wx.TE_RICH2)
20 richText.SetInsertionPoint(0)
21 richText.SetStyle(44, 52, wx.TextAttr("white", "black"))
22 points = richText.GetFont().GetPointSize()
23 f = wx.Font(points + 3, wx.ROMAN, wx.ITALIC, wx.BOLD, True)
24 richText.SetStyle(68, 82, wx.TextAttr("blue", wx.NullColour, f))
25 sizer = wx.FlexGridSizer(cols=2, hgap=6, vgap=6)
26 sizer.AddMany([multiLabel, multiText, richLabel, richText])
27 panel.SetSizer(sizer)
28
29 if __name__ == '__main__':
30 app = wx.PySimpleApp()
31 frame = TextFrame()
32 frame.Show()
33 app.MainLoop()