Skip to content

Commit

Permalink
Assert
Browse files Browse the repository at this point in the history
  • Loading branch information
rdbende committed Mar 18, 2023
1 parent 91f2b6c commit 1efbcff
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions sv_ttk.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,13 @@ def set_theme(theme):
if theme not in {"dark", "light"}:
raise RuntimeError("not a valid theme name: {}".format(theme))

assert root is not None
root.tk.call("set_theme", theme)


@init_theme
def get_theme():
assert root is not None
theme = root.tk.call("ttk::style", "theme", "use")

return {"sun-valley-dark": "dark", "sun-valley-light": "light"}.get(theme, theme)
Expand Down

0 comments on commit 1efbcff

Please sign in to comment.