@@ -0,0 +1,2478 @@
+# -*- coding: utf-8 -*-%0A%0A# Copyright (c) 2022 shmilee%0A%0Aimport tkinter%0Afrom tkinter import ttk%0Afrom tkinter.constants import *%0A%0A%0Aclass Slider(ttk.Frame):%0A    '''Float/Int RangeSlider'''  # TODO%0A%0A    def __init__(self, master,%0A                 min_val=0, max_val=1, init_val=None, step=None, val_type=float,%0A                 desc=None, length=200, show_value=True, style=None):%0A        super(Slider, self).__init__(master)%0A        self.max_val = max_val%0A        self.min_val = min_val%0A        if init_val == None:%0A            init_val = %5Bmin_val%5D%0A        self.init_val = init_val%0A        self.val_type = val_type%0A        self.show_value = show_value%0A        style = style or %7B%7D%0A        self.LINE_COLOR = style.get('LINE_COLOR', %22#476b6b%22)%0A        self.LINE_WIDTH = style.get('LINE_WIDTH', 2)%0A        self.BAR_COLOR_INNER = style.get('BAR_COLOR_INNER', %22#5c8a8a%22)%0A        self.BAR_COLOR_OUTTER = style.get('BAR_COLOR_OUTTER', %22#c2d6d6%22)%0A        self.BAR_RADIUS = style.get('BAR_RADIUS', 8)%0A        self.BAR_RADIUS_INNER = style.get('BAR_RADIUS_INNER', 4)%0A        if val_type == int:%0A            self.NDIGITS = style.get('NDIGITS', None)%0A        else:%0A            # for showing in canvas & converting value%0A            self.NDIGITS = style.get('NDIGITS', 1)%0A        if desc:%0A            self.desc = tkinter.Label(self, text=desc, bg='green')%0A            self.desc.grid(in_=self, row=0, column=0, padx=5, pady=5, sticky=W)%0A        if show_value:%0A            self.textvariable = tkinter.StringVar(self)%0A            self.textvariable.set(min_val)%0A            self.vlabel = tkinter.Label(%0A                self, textvariable=self.textvariable, bg='yellow')%0A            self.vlabel.grid(in_=self, row=0, column=1,%0A                             padx=5, pady=5, sticky=E)%0A%0A        self.canvas = tkinter.Canvas(%0A            self, bg='red', bd=0, width=length+2*self.BAR_RADIUS, height=2*self.BAR_RADIUS+4)%0A        self.canvas.grid(in_=self, row=1, column=0,%0A                         columnspan=2, padx=5, pady=5, sticky=W+E)%0A        self.line = self.canvas.create_line(%0A            self.BAR_RADIUS, self.BAR_RADIUS+2, length+self.BAR_RADIUS, self.BAR_RADIUS+2,%0A            fill=self.LINE_COLOR, width=self.LINE_WIDTH)%0A%0A%0Aif __name__ == '__main__':%0A    root = tkinter.Tk()%0A    slider = Slider(%0A        root,%0A        min_val=110, max_val=1000, init_val=(120, 400), step=10,%0A        desc='Test:', length=100)%0A    slider.pack(side=LEFT, padx=2)%0A    root.title(%22Slider Widget%22)%0A    root.mainloop()%0A

add tkSliderTest, TODO step support