[Python-checkins] r64279 - sandbox/trunk/ttk-gsoc/samples/ttkcalendar.py

guilherme.polo python-checkins at python.org
Sat Jun 14 18:52:48 CEST 2008


Author: guilherme.polo
Date: Sat Jun 14 18:52:47 2008
New Revision: 64279
Log:
Set widget minimal size
Modified:
 sandbox/trunk/ttk-gsoc/samples/ttkcalendar.py
Modified: sandbox/trunk/ttk-gsoc/samples/ttkcalendar.py
==============================================================================
--- sandbox/trunk/ttk-gsoc/samples/ttkcalendar.py	(original)
+++ sandbox/trunk/ttk-gsoc/samples/ttkcalendar.py	Sat Jun 14 18:52:47 2008
@@ -58,6 +58,9 @@
 # insert dates in the currently empty calendar
 self._build_calendar()
 
+ # set the minimal size for the widget
+ self._calendar.bind('<Map>', self.__minsize)
+
 def __setup_styles(self):
 # custom ttk styles
 style = ttk.Style(self.master)
@@ -92,7 +95,8 @@
 font = tkFont.Font()
 maxwidth = max(font.measure(col) for col in cols)
 for col in cols:
- self._calendar.column(col, width=maxwidth, anchor='e')
+ self._calendar.column(col, width=maxwidth, minwidth=maxwidth,
+ anchor='e')
 
 def __setup_selection(self, sel_bg, sel_fg):
 self._font = tkFont.Font()
@@ -104,6 +108,11 @@
 self._calendar.bind('<Configure>', lambda evt: canvas.place_forget())
 self._calendar.bind('<ButtonPress-1>', self._pressed)
 
+ def __minsize(self, evt):
+ width, height = self._calendar.master.geometry().split('x')
+ height = height[:height.index('+')]
+ self._calendar.master.minsize(width, height)
+
 def _build_calendar(self):
 year, month = self._date.year, self._date.month
 


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /