]>
Commit | Line | Data |
---|---|---|
1b62f00d RD |
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 | import string | |
40 | overview = string.replace(fancytext.__doc__, "<", "<") | |
41 |