Closed jmaraquea closed 2 weeks ago
I am sorry @jmaraquea for such a super late reply, got occupied in something personal, I hope you could manage your work meanwhile. The above is because callbacks in trace_add need to have three arguments. You can look at https://stackoverflow.com/questions/29690463/what-are-the-arguments-to-tkinter-variable-trace-method-callbacks or https://www.geeksforgeeks.org/tracing-tkinter-variables-in-python/ for better understanding.
When using the following code I get an error despite not giving any arguments
from RangeSlider import RangeSliderH, RangeSliderV
from tkinter.ttk import * import tkinter as tk
root = tk.Tk()
hLeft = tk.DoubleVar(value = 0.2) #left handle variable initialised to value 0.2 hRight = tk.DoubleVar(value = 0.85) #right handle variable initialised to value 0.85 hSlider = RangeSliderH( root , [hLeft, hRight], padX = 12, step_marker = True, step_size = 0.1) #horizontal slider hSlider.pack() # or grid or place method could be used
vBottom = tk.DoubleVar(value = 0) #bottom handle variable vTop = tk.DoubleVar(value = 1) #top handle variable vSlider = RangeSliderV( root, [vBottom, vTop], padY = 12) #vertical slider vSlider.pack() # or grid or place method could be used
def doSomething(): print ('I was called.')
hLeft.trace_add('write', doSomething) #
root.mainloop()
TypeError: doSomething() takes 0 positional arguments but 3 were given