[Python-checkins] r64510 - sandbox/trunk/ttk-gsoc/samples/theming.py

guilherme.polo python-checkins at python.org
Tue Jun 24 17:39:58 CEST 2008


Author: guilherme.polo
Date: Tue Jun 24 17:39:58 2008
New Revision: 64510

Log:
Correctly shows the current options for a widget;
Did some relayout, first attempt to organize the widgets.


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

Modified: sandbox/trunk/ttk-gsoc/samples/theming.py
==============================================================================
--- sandbox/trunk/ttk-gsoc/samples/theming.py	(original)
+++ sandbox/trunk/ttk-gsoc/samples/theming.py	Tue Jun 24 17:39:58 2008
@@ -178,6 +178,7 @@
         layout_name = widget['layout']
         raw_name = layout_name[layout_name.find('.', 1) + 1:]
         options = self._style.configure(raw_name)
+        options.update(self._style.configure(layout_name))
         frame = self._configframe
 
         self._current_options = self._current_options or []
@@ -262,39 +263,46 @@
         # options, images and themes
         frames = ttk.Frame(topright)
         frames.pack(side='right', anchor='n')
-        # style configure frame
-        self._configframe = configframe = ttk.Labelframe(frames,
-            text="Style configure", padding=6, height=42)
-        configframe.pack(fill='x')
-        # style map frame (XXX not done)
-        self._mapframe = mapframe = ttk.Labelframe(frames, text="Style map",
-            padding=6, height=42)
-        mapframe.pack(fill='x', pady=12)
-        # images frame (XXX not done)
-        imagesframe = ttk.Labelframe(frames, text="Images", padding=6,
-            height=42)
-        imagesframe.pack(fill='x')
-        # themes frame
-        themeframe = ttk.Labelframe(frames, text="Themes", padding=6)
+        # style notebook and frames
+        styleframe = ttk.Labelframe(frames, text="Style", padding=6)
+        stylenb = ttk.Notebook(styleframe)
+        self._configframe = ttk.Frame(stylenb, padding=6)
+        self._configframe.pack()
+        self._mapframe = ttk.Frame(stylenb, padding=6) # XXX not done
+        self._mapframe.pack()
+        themeframe = ttk.Frame(stylenb, padding=6)
+        themeframe.pack(padx=6)
         themes = ttk.Combobox(themeframe, values=self._style.theme_names(),
             state='readonly')
         themes.set("Pick one")
         themes.bind('<<ComboboxSelected>>', self._change_theme)
         themes.pack(fill='x')
-        themeframe.pack(fill='x', pady=12)
+        stylenb.add(self._configframe, text="Configure")
+        stylenb.add(self._mapframe, text="Map")
+        stylenb.add(themeframe, text="Themes")
+        stylenb.pack(fill='both', anchor='n')
+        styleframe.pack(fill='both', anchor='n')
+        # images frame (XXX not done)
+        imagesframe = ttk.Labelframe(frames, text="Images", padding=6,
+            height=42)
+        imagesframe.pack(fill='x', pady=12)
 
         # bottom frame (layout)
         bottom = ttk.Frame(paned, padding=[0, 0, 6])
         bottom.pack(side='bottom', fill='both')
         layoutframe = ttk.Labelframe(bottom, text="Layout", padding=6)
         layoutframe.pack(fill='both', expand=True)
-        self.layouttext = ScrolledText(layoutframe, width=80, height=10)
-        apply_btn = ttk.Button(layoutframe, text="Apply",
+        textframe = ttk.Frame(layoutframe)
+        textframe.pack(side='left', fill='both', expand=True)
+        self.layouttext = ScrolledText(textframe)
+        btnsframe = ttk.Frame(layoutframe, padding=[6, 0, 0, 0])
+        btnsframe.pack(side='right', anchor='n', fill='x')
+        apply_btn = ttk.Button(btnsframe, text="Apply",
             command=self._apply_layout)
-        reset_btn = ttk.Button(layoutframe, text="Reset",
+        reset_btn = ttk.Button(btnsframe, text="Reset",
             command=self._reset_layout)
-        apply_btn.pack(side='right')
-        reset_btn.pack(side='right', padx=6)
+        apply_btn.pack(side='top')
+        reset_btn.pack(side='top', pady=6)
 
         paned.add(top)
         paned.add(bottom)


More information about the Python-checkins mailing list