[Python-checkins] r64675 - sandbox/trunk/ttk-gsoc/samples/theming.py
guilherme.polo
python-checkins at python.org
Wed Jul 2 23:46:57 CEST 2008
Author: guilherme.polo
Date: Wed Jul 2 23:46:57 2008
New Revision: 64675
Log:
Removed unused imports;
Some options, for some widgets, were not being fetched;
Other misc changes;
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 Wed Jul 2 23:46:57 2008
@@ -11,12 +11,11 @@
# - Just after editing elements feature is added.
import os
-import sys
import ttk
import pprint
import cStringIO
import Tkinter
-from tkSimpleDialog import Dialog, askstring
+from tkSimpleDialog import Dialog
from tkMessageBox import showwarning, showerror
from tkFileDialog import askopenfilename
@@ -121,9 +120,9 @@
def widget_paned(widget, master, **kw):
"""Create a sample Panedwindow with two children."""
- w = widget(master, height=150, orient='vertical', **kw)
- w.add(ttk.Label(w, text="Top"))
- w.add(ttk.Label(w, text="Bottom"))
+ w = widget(master, height=150, **kw)
+ w.add(ttk.Label(w, text="Child 1"))
+ w.add(ttk.Label(w, text="Child 2"))
return w
def widget_expand(widget, master, **kw):
@@ -546,14 +545,14 @@
def _update_style(self, func, frame):
"""Treeview selection changed, update the displayed style."""
widget = self._current_widget
- layout_name = widget['layout']
- raw_name = layout_name[layout_name.find('.', 1) + 1:]
- options = func(raw_name)
- options.update(func(layout_name))
+ widget_base_layout = widget['widget'].winfo_class()
+ custom_layout = widget['layout']
+ options = func(widget_base_layout)
+ options.update(func(custom_layout))
# add options to the specified frame
for opt_name, opt_value in options.items():
- self._add_opt_frame(frame, func, layout_name, opt_name, opt_value)
+ self._add_opt_frame(frame, func, custom_layout, opt_name, opt_value)
def _add_opt_frame(self, frame, func, layout_name, opt_name, opt_value):
"""Add a new option to a frame."""
@@ -614,7 +613,7 @@
self.layouttext.layout = layout
def _new_frame_opt(self, frame, func):
- """Open a dialog asking for a new option to be added in the
+ """Open a dialog asking for a new custom option to be added in the
specified frame and then add it."""
widget = self._current_widget
if widget['widget'] is None:
@@ -862,10 +861,10 @@
self._add_widget(name, opts)
-def main(args=None):
+def main():
root = Tkinter.Tk()
app = MainWindow(root, 'Ttk Theming')
root.mainloop()
if __name__ == "__main__":
- main(sys.argv)
+ main()
More information about the Python-checkins
mailing list