If themename is None, returns the theme in use, otherwise, set the current theme to themename, refreshes all widgets and emits a < > event.
(self, themename=None)
| 493 | |
| 494 | |
| 495 | def theme_use(self, themename=None): |
| 496 | """If themename is None, returns the theme in use, otherwise, set |
| 497 | the current theme to themename, refreshes all widgets and emits |
| 498 | a <<ThemeChanged>> event.""" |
| 499 | if themename is None: |
| 500 | # Starting on Tk 8.6, checking this global is no longer needed |
| 501 | # since it allows doing self.tk.call(self._name, "theme", "use") |
| 502 | return self.tk.eval("return $ttk::currentTheme") |
| 503 | |
| 504 | # using "ttk::setTheme" instead of "ttk::style theme use" causes |
| 505 | # the variable currentTheme to be updated, also, ttk::setTheme calls |
| 506 | # "ttk::style theme use" in order to change theme. |
| 507 | self.tk.call("ttk::setTheme", themename) |
| 508 | |
| 509 | |
| 510 | class Widget(tkinter.Widget): |