Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions tkdial/imageknob.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,13 @@ def __init__(self,
super().bind('<MouseWheel>', self.scroll_command)
super().bind("<Button-4>", lambda e: self.scroll_command(-1))
super().bind("<Button-5>", lambda e: self.scroll_command(1))


if self.command is not None:
try:
self.command(self.value)
except TypeError:
self.command()

def draw(self):
while True:
tkimage = ImageTk.PhotoImage(self.image.rotate(self.angle))
Expand Down Expand Up @@ -199,7 +205,10 @@ def set(self, value):
self.itemconfig(tagOrId='text', text=self.text+str(value), fill=self.text_color)

if self.command is not None:
self.command()
try:
self.command(self.value)
except TypeError:
self.command()

def get(self):
"""
Expand Down
6 changes: 4 additions & 2 deletions tkdial/jogwheel.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,8 +303,10 @@ def set(self, value):
if self.text:
self.itemconfig(tagOrId='text', text=self.text+str(value), fill=self.text_color)

if self.previous_angle!=0:
if self.command is not None:
if self.command is not None:
try:
self.command(self.value)
except TypeError:
self.command()

def get(self):
Expand Down
6 changes: 4 additions & 2 deletions tkdial/meter.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,8 +282,10 @@ def set(self, value):
if self.text:
self.itemconfig(tagOrId='text', text=str(value)+self.text, fill=self.text_color)

if self.previous_angle!=0:
if self.command is not None:
if self.command is not None:
try:
self.command(self.value)
except TypeError:
self.command()

def get(self):
Expand Down
13 changes: 11 additions & 2 deletions tkdial/scrollknob.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,13 @@ def __init__(self,
self.bind('<MouseWheel>', self.scroll_command)
self.bind("<Button-4>", lambda e: self.scroll_command(-1))
self.bind("<Button-5>", lambda e: self.scroll_command(1))


if self.command is not None:
try:
self.command(self.value)
except TypeError:
self.command()

def scroll_command(self, event):
"""
This function is used to change the value of the knob with mouse scroll
Expand Down Expand Up @@ -150,7 +156,10 @@ def scroll_command(self, event):
self.set_text()

if self.command is not None:
self.command()
try:
self.command(self.value)
except TypeError:
self.command()

def set_text(self):
"""
Expand Down
13 changes: 11 additions & 2 deletions tkdial/tkdial.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,13 @@ def __init__(
super().bind('<MouseWheel>', self.scroll_command)
super().bind("<Button-4>", lambda e: self.scroll_command(-1))
super().bind("<Button-5>", lambda e: self.scroll_command(1))


if self.__command is not None:
try:
self.__command(self.value)
except TypeError:
self.__command()

def scroll_command(self, event):
"""
This function is used to change the value of the dial with mouse scroll
Expand Down Expand Up @@ -396,7 +402,10 @@ def __rotate_needle(self, event, angle=None) -> None:
text=f"{self.__text_title}{int(self.value)}"
)
if self.__command is not None:
self.__command()
try:
self.__command(self.value)
except TypeError:
self.__command()

def __create_text(self) -> None:
"""
Expand Down