Skip to content

Commit

Permalink
Propagated click changes to other button colors
Browse files Browse the repository at this point in the history
  • Loading branch information
slightlynybbled committed May 4, 2018
1 parent afee1e1 commit eb05109
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
12 changes: 12 additions & 0 deletions tk_tools/canvas.py
Original file line number Diff line number Diff line change
Expand Up @@ -556,9 +556,15 @@ def to_red(self, on: bool=False):
self._on = on
if on:
self._load_new(led_red_on)

if self._toggle_on_click:
self._canvas.bind('<Button-1>', lambda x: self.to_red(False))
else:
self._load_new(led_red)

if self._toggle_on_click:
self._canvas.bind('<Button-1>', lambda x: self.to_red(True))

def to_yellow(self, on: bool=False):
"""
Change the LED to yellow (on or off)
Expand All @@ -568,5 +574,11 @@ def to_yellow(self, on: bool=False):
self._on = on
if on:
self._load_new(led_yellow_on)

if self._toggle_on_click:
self._canvas.bind('<Button-1>', lambda x: self.to_yellow(False))
else:
self._load_new(led_yellow)

if self._toggle_on_click:
self._canvas.bind('<Button-1>', lambda x: self.to_yellow(True))
2 changes: 1 addition & 1 deletion tk_tools/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '0.9.0'
__version__ = '0.9.1'

0 comments on commit eb05109

Please sign in to comment.