hi every one
i created a slidebar in tkinter. as i move it forward the value of a variable increases. but as i move it backwards, the value also increases. it should decrease. do u guys have a simple slidebar implemeted and which affect the value of an attribute? thanks

def move(self, value):
self.a+=1000

when i move the sliderbar in either direction, the value of a increases. i want to put a condition to this method to decrease the value of a by '1000' if the user slides the slidebar to the left. else if the user slides it to the right, it increases by '1000'.
help plz

Here is one example ...

# explore Tkinter's Scale (slider) widget response

import Tkinter as tk

def show_position(value):
    """show slider position in the window title"""
    # you can use scale.get() or value
    s = "position = %s" % value
    root.title(s)


root = tk.Tk()
# use width x height + x_offset + y_offset (no spaces!)
root.geometry("350x100+30+30")

# create a horizontal scale/slider with values 
# from 0 to 12000 sliding in steps of 1000
scale = tk.Scale(root, label="move slider:", 
    from_=0, to=12000, resolution=1000,
    command=show_position,
    orient='horizontal', length=300)
scale.pack(side='left', expand='yes', fill='y')

root.mainloop()
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.