Returning a value from TkInter Slider + making slider horizontal with classes Returning a value from TkInter Slider + making slider horizontal with classes tkinter tkinter

Returning a value from TkInter Slider + making slider horizontal with classes


When you use a command argument you have to pass there a reference to a callable object. Function that will be called after the event. What you're doing is that you're passing there the result from self.print_slide_value(slider.get()), which is None.

Instead do:

def print_slide_value():    print slider.get()button_cheat = tki.Button(slider_window, text='Print Value', command=print_slide_value)

Also I had no problems with this:

slider = tki.Scale(slider_window, from_=100, to=1000, orient=tki.HORIZONTAL)