[Python-checkins] r64502 - sandbox/trunk/ttk-gsoc/samples/widget_state.py

guilherme.polo python-checkins at python.org
Tue Jun 24 16:21:15 CEST 2008


Author: guilherme.polo
Date: Tue Jun 24 16:21:14 2008
New Revision: 64502

Log:
Font family may contain spaces, so it needed special formatting in that case;
Removed unused import and fixed indentation in two lines.


Modified:
   sandbox/trunk/ttk-gsoc/samples/widget_state.py

Modified: sandbox/trunk/ttk-gsoc/samples/widget_state.py
==============================================================================
--- sandbox/trunk/ttk-gsoc/samples/widget_state.py	(original)
+++ sandbox/trunk/ttk-gsoc/samples/widget_state.py	Tue Jun 24 16:21:14 2008
@@ -1,6 +1,4 @@
 """Sample demo showing widget states and some font styling."""
-import sys
-
 import ttk
 
 states = ['active', 'disabled', 'focus', 'pressed', 'selected',
@@ -24,6 +22,8 @@
         btn_font = self.style.lookup("TButton", "-font")
         fsize = self.tk.eval("font configure %s -size" % btn_font)
         self.font_family = self.tk.eval("font configure %s -family" % btn_font)
+        if ' ' in self.font_family:
+            self.font_family = '{%s}' % self.font_family
         self.fsize_prefix = fsize[0] if fsize[0] == '-' else ''
         self.base_fsize = int(fsize[1 if fsize[0] == '-' else 0:])
 
@@ -53,8 +53,8 @@
 
         # set new widget state
         for widget in self.update_widgets:
-           reset_state(widget) # remove any previous state from the widget
-           widget.state(goodstates)
+            reset_state(widget) # remove any previous state from the widget
+            widget.state(goodstates)
 
         # update Ttk Button font size
         self._set_font(font_extra)


More information about the Python-checkins mailing list