]> git.saurik.com Git - wxWidgets.git/blob - wxPython/demo/FancyText.py
fix text scrolling in GTK2 (patch 703988)
[wxWidgets.git] / wxPython / demo / FancyText.py
1
2 from wxPython.wx import *
3 from wxPython.lib import fancytext
4
5 #----------------------------------------------------------------------
6
7 test_str = ('<font style="italic" family="swiss" color="red" weight="bold" >'
8 'some |<sup>23</sup> <angle/>text<sub>with <angle/> subscript</sub>'
9 '</font> some other text')
10
11 test_str2 = '<font family="swiss" color="dark green" size="40">big green text</font>'
12
13
14 class TestPanel(wxPanel):
15 def __init__(self, parent):
16 wxPanel.__init__(self, parent, -1)
17 EVT_PAINT(self, self.OnPaint)
18
19
20 def OnPaint(self, evt):
21 dc = wxPaintDC(self)
22
23 sz = fancytext.getExtent(test_str, dc)
24 fancytext.renderToDC(test_str, dc, 20, 20)
25
26 fancytext.renderToDC(test_str2, dc, 20, 20 + sz.height + 10)
27
28
29 #----------------------------------------------------------------------
30
31 def runTest(frame, nb, log):
32 win = TestPanel(nb)
33 return win
34
35 #----------------------------------------------------------------------
36
37
38
39 overview = fancytext.__doc__.replace("<", "&lt;")
40
41
42
43
44 if __name__ == '__main__':
45 import sys,os
46 import run
47 run.main(['', os.path.basename(sys.argv[0])])
48