]> git.saurik.com Git - wxWidgets.git/blame - wxPython/demo/FancyText.py
reSWIGged
[wxWidgets.git] / wxPython / demo / FancyText.py
CommitLineData
1b62f00d
RD
1
2from wxPython.wx import *
3from wxPython.lib import fancytext
4
5#----------------------------------------------------------------------
6
7test_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
11test_str2 = '<font family="swiss" color="dark green" size="40">big green text</font>'
12
13
14class 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
31def runTest(frame, nb, log):
32 win = TestPanel(nb)
33 return win
34
35#----------------------------------------------------------------------
36
37
38
1e4a197e 39overview = fancytext.__doc__.replace("<", "&lt;")
1b62f00d 40
1fded56b
RD
41
42
43
44if __name__ == '__main__':
45 import sys,os
46 import run
47 run.main(['', os.path.basename(sys.argv[0])])
48