[Python-checkins] r65288 - in sandbox/trunk/ttk-gsoc: Doc/library/ttk.rst src/2.x/ttk.py src/3.x/ttk.py
guilherme.polo
python-checkins at python.org
Tue Jul 29 17:56:39 CEST 2008
Author: guilherme.polo
Date: Tue Jul 29 17:56:39 2008
New Revision: 65288
Log:
Fixed a problem regarding theme_use not returning the current theme in use after theme changed.
Modified:
sandbox/trunk/ttk-gsoc/Doc/library/ttk.rst
sandbox/trunk/ttk-gsoc/src/2.x/ttk.py
sandbox/trunk/ttk-gsoc/src/3.x/ttk.py
Modified: sandbox/trunk/ttk-gsoc/Doc/library/ttk.rst
==============================================================================
--- sandbox/trunk/ttk-gsoc/Doc/library/ttk.rst (original)
+++ sandbox/trunk/ttk-gsoc/Doc/library/ttk.rst Tue Jul 29 17:56:39 2008
@@ -1340,8 +1340,9 @@
.. method:: theme_use([themename])
- If *themename* is not given, returns the theme in use, otherwise set
- the current theme to *themename* and refreshes all widgets.
+ If *themename* is not given, returns the theme in use, otherwise, set
+ the current theme to *themename*, refreshes all widgets and emits a
+ <<ThemeChanged>> event.
Layouts
Modified: sandbox/trunk/ttk-gsoc/src/2.x/ttk.py
==============================================================================
--- sandbox/trunk/ttk-gsoc/src/2.x/ttk.py (original)
+++ sandbox/trunk/ttk-gsoc/src/2.x/ttk.py Tue Jul 29 17:56:39 2008
@@ -12,7 +12,7 @@
of the widgets appearance lies at Themes.
"""
-__version__ = "0.1.4"
+__version__ = "0.1.5"
__author__ = "Guilherme Polo <ggpolo at gmail.com>"
@@ -511,14 +511,18 @@
def theme_use(self, themename=None):
- """If themename is None, returns the theme in use, otherwise set
- the current theme to themename and refreshes all widgets."""
+ """If themename is None, returns the theme in use, otherwise, set
+ the current theme to themename, refreshes all widgets and emits
+ a <<ThemeChanged>> event."""
if themename is None:
# Starting on Tk 8.6, checking this global is no longer needed
# since it allows doing self.tk.call(self._name, "theme", "use")
- return self.tk.eval("return $::ttk::currentTheme")
+ return self.tk.eval("return $ttk::currentTheme")
- self.tk.call(self._name, "theme", "use", themename)
+ # using "ttk::setTheme" instead of "ttk::style theme use" causes
+ # the variable currentTheme to be updated, also, ttk::setTheme calls
+ # "ttk::style theme use" in order to change theme.
+ self.tk.call("ttk::setTheme", themename)
class Widget(Tkinter.Widget):
Modified: sandbox/trunk/ttk-gsoc/src/3.x/ttk.py
==============================================================================
--- sandbox/trunk/ttk-gsoc/src/3.x/ttk.py (original)
+++ sandbox/trunk/ttk-gsoc/src/3.x/ttk.py Tue Jul 29 17:56:39 2008
@@ -12,7 +12,7 @@
of the widgets appearance lies at Themes.
"""
-__version__ = "0.1.4"
+__version__ = "0.1.5"
__author__ = "Guilherme Polo <ggpolo at gmail.com>"
@@ -511,14 +511,18 @@
def theme_use(self, themename=None):
- """If themename is None, returns the theme in use, otherwise set
- the current theme to themename and refreshes all widgets."""
+ """If themename is None, returns the theme in use, otherwise, set
+ the current theme to themename, refreshes all widgets and emits
+ a <<ThemeChanged>> event."""
if themename is None:
# Starting on Tk 8.6, checking this global is no longer needed
# since it allows doing self.tk.call(self._name, "theme", "use")
- return self.tk.eval("return $::ttk::currentTheme")
+ return self.tk.eval("return $ttk::currentTheme")
- self.tk.call(self._name, "theme", "use", themename)
+ # using "ttk::setTheme" instead of "ttk::style theme use" causes
+ # the variable currentTheme to be updated, also, ttk::setTheme calls
+ # "ttk::style theme use" in order to change theme.
+ self.tk.call("ttk::setTheme", themename)
class Widget(tkinter.Widget):
More information about the Python-checkins
mailing list