diff --git a/README.md b/README.md index 1521f30..39094df 100644 --- a/README.md +++ b/README.md @@ -130,7 +130,7 @@ sub-folder. Then, set the theme using the GTTK class ```python gttk = GTTK(window, theme="THEME_NAME_HERE") # OR -gttk.set_theme("THEME_NAME_HERE") +gttk.set_gtk_theme("THEME_NAME_HERE") ``` or you can create a `~/.gtkrc` file (the specific paths of the files that are parsed are found with `GTTK().get_default_files()`) and having @@ -142,6 +142,14 @@ gtk-theme-name = "THEME_NAME_HERE" This will then be applied to all GTK applications that read the resource file. +### Listing available theme +To list up available theme, run this function: +```python +gttk=GTTK(window) +gttk.get_themes_available() #this +``` +It return tuple of theme names. + ## Screenshots `gttk` should work with any GTK theme you can throw at it, but below are the themes Yaru and Adwaita as examples. diff --git a/gttk/__init__.py b/gttk/__init__.py index 20ec9f9..409f555 100644 --- a/gttk/__init__.py +++ b/gttk/__init__.py @@ -81,6 +81,14 @@ def __init__(self, window: tk.Tk, theme: Optional[str] = None, theme_dir_prefix: def get_themes_directory(self) -> str: """Return the directory in which GTK looks for installed themes""" return self.tk.call("ttk::theme::gttk::gtkDirectory", "theme") + + def get_themes_available(self) -> Tuple[str]: + """Return installed themes""" + themes=self.tk.call("ttk::theme::gttk::availableStyles") + if themes == '': + return () + else: + return themes def get_default_files(self) -> Tuple[str]: """Return the files that GTK parses by default at start-up"""