Added 'description' class attribute to every command class (to help the
[python/dscho.git] / Demo / sgi / gl / glstdwin / fontchart.py
blob6b58f12a9c9254d2fe8f4e5911078576f9ea5903
1 import stdwingl
3 import stdwin
4 from stdwinevents import *
6 def main():
7 size = 12
8 w = stdwin.open('Font chart ' + `size`)
9 while 1:
10 type, window, detail = stdwin.getevent()
11 if type == WE_CLOSE:
12 break
13 if type == WE_DRAW:
14 width, height = w.getwinsize()
15 d = w.begindrawing()
16 d.setsize(size)
17 h, v = 0, 0
18 for c in range(32, 256):
19 ch = chr(c)
20 chw = d.textwidth(ch)
21 if h + chw > width:
22 v = v + d.lineheight()
23 h = 0
24 if v >= height:
25 break
26 d.text((h, v), ch)
27 h = h + chw
28 del d
29 if type == WE_MOUSE_UP:
30 size = size + 1
31 w.settitle('Font chart ' + `size`)
32 w.change((0, 0), (2000, 2000))
34 main()