0

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

2
Contributors
2
Replies
3
Views
8 Years
Discussion Span
Last Post by vegaseat
0

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

0

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()
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.