root/packages/dialogKit/trunk/examples/GlyphLineViewDemo.py

Revision 1, 1.0 kB (checked in by tal, 1 year ago)
initial import
Line 
1 import os
2 from FL import *
3 from dialogKit import *
4
5 def _allFonts():
6     return [fl[i] for i in xrange(len(fl))]
7
8 class GlyphLineViewDemo(object):
9    
10     def __init__(self):
11         self.allFonts = [(os.path.basename(font.file_name), font) for font in _allFonts()]
12         self.allFontNames = [name for name, font in self.allFonts]
13         self.w = ModalDialog((500, 230), 'GlyphLineView Demo')
14         #
15         self.w.textEntry = EditText((10, 10, 480, 27), 'HELLO!', callback=self.textEntryCallback)
16         #
17         self.w.glyphLineView = GlyphLineView((10, 50, 480, 120))
18         #
19         self.w.fontOption = PopUpButton((10, -37, 150, 22), items=self.allFontNames, callback=self.fontOptionCallback)
20         #
21         self.w.open()
22    
23     def textEntryCallback(self, sender):
24         text = sender.get()
25         self.w.glyphLineView.set(text)
26    
27     def fontOptionCallback(self, sender):
28         index = sender.getSelection()
29         font = self.allFonts[index][1]
30         self.w.glyphLineView.setFont(font)
31
32 GlyphLineViewDemo()
Note: See TracBrowser for help on using the browser.