A
A
aaaaaNaaasTasia2021-10-03 11:13:14
Python
aaaaaNaaasTasia, 2021-10-03 11:13:14

How to move the widget by the distance given by the scale method?

I need to move the lbl widget by a certain number of pixels. The number of pixels is determined by the value that the user has set using the scale, but the problem is that I can't figure out how to save the previous values. That is, if the first time the object was moved by 3 pixels, then at the output I will get 153 pixels. The second move should be from 153 pixels, not from 150 again.
Here is an excerpt from the code

def comm_f_rbtn1():
    b_2.place(x=160, y=420)

    def scrb1(event):
        if b_2:
            z=150
            l1st=list()
            l1st.append(scale.get())
            a=sum(l1st)
            total=z+a
            lbl.place(x=150, y=total)
            z+=a



    b_2.bind('<Button-1>', scrb1)

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question