Skip to content

Commit

Permalink
Use SliderWithProgressBar instead of base Slider
Browse files Browse the repository at this point in the history
  • Loading branch information
pozitronik committed Nov 6, 2024
1 parent 060c857 commit af1f233
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions sinner/gui/controls/FramePosition/SliderFramePosition.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
from tkinter import Label, StringVar, Frame, X, TOP, NW, DISABLED, NORMAL, IntVar, Misc
from typing import Union, Callable, Any, Dict

from customtkinter import CTkSlider

from sinner.gui.controls.FramePosition.BaseFramePosition import BaseFramePosition
from sinner.gui.controls.FramePosition.SliderWithProgress import SliderWithProgress


class SliderFramePosition(BaseFramePosition, CTkSlider):
class SliderFramePosition(BaseFramePosition, SliderWithProgress):
_container: Frame
_position_label: Label
_current_position: StringVar
Expand All @@ -16,21 +16,21 @@ def __init__(self, master: Misc | None, **kwargs): # type: ignore[no-untyped-de
self._container = Frame(master, borderwidth=2)
self._current_position = StringVar()
self._position_label = Label(master)
CTkSlider.__init__(self, self._container, **kwargs)
SliderWithProgress.__init__(self, self._container, **kwargs)
self._position_label.configure(textvariable=self._current_position)
self.update_position()

def pack(self, **kwargs: Dict[str, Any]) -> Any:
self._container.pack(fill=X)
result = CTkSlider.pack(self, **kwargs)
result = SliderWithProgress.pack(self, **kwargs)
self._position_label.pack(anchor=NW, side=TOP, expand=False, fill=X, after=self)
return result

def pack_forget(self) -> Any:
self._container.pack_forget()

def _clicked(self, event: Any | None = None) -> None:
CTkSlider._clicked(self, event)
SliderWithProgress._clicked(self, event)
self.update_position()

def set(self, output_value: int, from_variable_callback: bool = False) -> None:
Expand Down Expand Up @@ -86,7 +86,7 @@ def container(self) -> Frame:
return self._container

def disable(self) -> None:
CTkSlider.configure(self, True, state=DISABLED)
SliderWithProgress.configure(self, True, state=DISABLED)

def enable(self) -> None:
CTkSlider.configure(self, True, state=NORMAL)
SliderWithProgress.configure(self, True, state=NORMAL)

0 comments on commit af1f233

Please sign in to comment.