mirror of
https://github.com/TomSchimansky/CustomTkinter.git
synced 2023-08-10 21:13:13 +03:00
added missing arguments to CTkSLider configure #1790
This commit is contained in:
parent
e116faf910
commit
9cfd5f4515
@ -1,4 +1,5 @@
|
||||
import tkinter
|
||||
import tkinterDnD
|
||||
from distutils.version import StrictVersion as Version
|
||||
import sys
|
||||
import os
|
||||
@ -12,8 +13,10 @@ from .widgets.appearance_mode import CTkAppearanceModeBaseClass
|
||||
|
||||
from customtkinter.windows.widgets.utility.utility_functions import pop_from_dict_by_set, check_kwargs_empty
|
||||
|
||||
TK_CLASS = tkinterDnD.Tk
|
||||
|
||||
class CTk(tkinter.Tk, CTkAppearanceModeBaseClass, CTkScalingBaseClass):
|
||||
|
||||
class CTk(TK_CLASS, CTkAppearanceModeBaseClass, CTkScalingBaseClass):
|
||||
"""
|
||||
Main app window with dark titlebar on Windows and macOS.
|
||||
For detailed information check out the documentation.
|
||||
@ -35,7 +38,7 @@ class CTk(tkinter.Tk, CTkAppearanceModeBaseClass, CTkScalingBaseClass):
|
||||
self._enable_macos_dark_title_bar()
|
||||
|
||||
# call init methods of super classes
|
||||
tkinter.Tk.__init__(self, **pop_from_dict_by_set(kwargs, self._valid_tk_constructor_arguments))
|
||||
TK_CLASS.__init__(self, **pop_from_dict_by_set(kwargs, self._valid_tk_constructor_arguments))
|
||||
CTkAppearanceModeBaseClass.__init__(self)
|
||||
CTkScalingBaseClass.__init__(self, scaling_type="window")
|
||||
check_kwargs_empty(kwargs, raise_error=True)
|
||||
|
@ -199,15 +199,30 @@ class CTkSlider(CTkBaseClass):
|
||||
outline=self._apply_appearance_mode(self._button_color))
|
||||
|
||||
def configure(self, require_redraw=False, **kwargs):
|
||||
if "state" in kwargs:
|
||||
self._state = kwargs.pop("state")
|
||||
self._set_cursor()
|
||||
if "corner_radius" in kwargs:
|
||||
self._corner_radius = kwargs.pop("corner_radius")
|
||||
require_redraw = True
|
||||
|
||||
if "button_corner_radius" in kwargs:
|
||||
self._button_corner_radius = kwargs.pop("button_corner_radius")
|
||||
require_redraw = True
|
||||
|
||||
if "border_width" in kwargs:
|
||||
self._border_width = kwargs.pop("border_width")
|
||||
require_redraw = True
|
||||
|
||||
if "button_length" in kwargs:
|
||||
self._button_length = kwargs.pop("button_length")
|
||||
require_redraw = True
|
||||
|
||||
if "fg_color" in kwargs:
|
||||
self._fg_color = self._check_color_type(kwargs.pop("fg_color"))
|
||||
require_redraw = True
|
||||
|
||||
if "border_color" in kwargs:
|
||||
self._border_color = self._check_color_type(kwargs.pop("border_color"), transparency=True)
|
||||
require_redraw = True
|
||||
|
||||
if "progress_color" in kwargs:
|
||||
self._progress_color = self._check_color_type(kwargs.pop("progress_color"), transparency=True)
|
||||
require_redraw = True
|
||||
@ -220,20 +235,17 @@ class CTkSlider(CTkBaseClass):
|
||||
self._button_hover_color = self._check_color_type(kwargs.pop("button_hover_color"))
|
||||
require_redraw = True
|
||||
|
||||
if "border_color" in kwargs:
|
||||
self._border_color = self._check_color_type(kwargs.pop("border_color"), transparency=True)
|
||||
require_redraw = True
|
||||
|
||||
if "border_width" in kwargs:
|
||||
self._border_width = kwargs.pop("border_width")
|
||||
require_redraw = True
|
||||
|
||||
if "from_" in kwargs:
|
||||
self._from_ = kwargs.pop("from_")
|
||||
|
||||
if "to" in kwargs:
|
||||
self._to = kwargs.pop("to")
|
||||
|
||||
if "state" in kwargs:
|
||||
self._state = kwargs.pop("state")
|
||||
self._set_cursor()
|
||||
require_redraw = True
|
||||
|
||||
if "number_of_steps" in kwargs:
|
||||
self._number_of_steps = kwargs.pop("number_of_steps")
|
||||
|
||||
@ -255,6 +267,10 @@ class CTkSlider(CTkBaseClass):
|
||||
else:
|
||||
self._variable = None
|
||||
|
||||
if "orientation" in kwargs:
|
||||
self._orientation = kwargs.pop("orientation")
|
||||
require_redraw = True
|
||||
|
||||
super().configure(require_redraw=require_redraw, **kwargs)
|
||||
|
||||
def cget(self, attribute_name: str) -> any:
|
||||
|
@ -28,7 +28,7 @@ button_1 = customtkinter.CTkButton(master=frame_1, command=button_callback)
|
||||
button_1.pack(pady=10, padx=10)
|
||||
|
||||
slider_1 = customtkinter.CTkSlider(master=frame_1, command=slider_callback, from_=0, to=1)
|
||||
slider_1.pack(pady=10, padx=10)
|
||||
slider_1.pack(pady=10, padx=10))
|
||||
slider_1.set(0.5)
|
||||
|
||||
entry_1 = customtkinter.CTkEntry(master=frame_1, placeholder_text="CTkEntry")
|
||||
|
Loading…
Reference in New Issue
Block a user