0

I have a tkinter.scale widget that is executing a command each time the scale is moved. My problem is that whenever i move the mouse it will execute the command rapidly as the scale changes position.

Similar to the tkinter.scrollbar widget that has the config parameter 'jump', I want my scale to execute the code ONLY when the mouse button is released, and not every time there is a change in the scale.

Rudy
  • 437
  • 2
  • 7

1 Answers1

3

You said ONLY when the mouse button is released - so why don't bind to the button release event?

import tkinter as tk

root = tk.Tk()

def something(event=None):
    print ("hi")

s = tk.Scale(root,from_=0, to=50)
s.pack()
s.bind("<ButtonRelease-1>",something)

root.mainloop()
Henry Yik
  • 22,275
  • 4
  • 18
  • 40