From: Kevin A. <al...@se...> - 2001-08-27 01:09:47
|
dialog.py, test_dialogs.py, and widget.py have been updated in cvs to use the new Font class. This is highly experimental, but doesn't appear to break any existing samples. I chose to combine and hide some of the wxPython font settings. A Font is described by its optional attributes: family: 'serif', 'sansSerif', 'monospace', 'default' faceName: an actual font name from the system (Arial, Courier New...) size: a number representing point size (8, 9, 10, etc.) style: 'regular', 'bold', 'italic', 'boldItalic' underline is currently turned off If None is passed in to initialize the Font class then you currently get a Font with an empty faceName, a default family, 8 point, and 'regular' style. If a faceName is present, it overrides the family attribute. If you specify a faceName then you risk that font not being available on a different system. You should only use 'faceName' right now for cross-platform compatibility. You can provide a 'font' attribute in the .rsrc.py files for a widget such as: 'font':{'family':'monospace', 'size':12} 'font':{'faceName':'Garamond', 'size':10, 'style':'boldItalic'} or you can set the font while the program is running. f = PythonCardPrototype.widget.Font({'family':'monospace', 'size':12}) self.field1.font = f I need to work on some mechanism, so that a list of alternative fonts can be searched for in order such as ["Garamond, Times New Roman, Times"] in order to make a match. I also need to provide a set of named fonts. Finally, I need to change the Font class initialization, so that the defaults aren't hard-coded, by using GetFont() on the background panel (Panel class) prior to initializing any of the widgets. ka |