Поэтому я пытаюсь поместить переменную в метки x ..., чтобы при изменении переменной метка начала двигаться.
Но проблема в том, что переменная не меняет своего значения, а остается на «0», когда я нажимаю кнопку «Далее»
Нужна помощь, пожалуйста:
import tkinter as tk
from docx import Document
HEIGHT = 500
WIDTH = 600
root = tk.Tk()
canvas = tk.Canvas(root, height=HEIGHT, width=WIDTH)
canvas.pack()
nextt=tk.IntVar()
nextt=0 #setup the nextt variable
label1 = tk.Label(text='example:')
label1.place(x=90+nextt,y=50) #put the variable here to affect position
def next2():
nextt=300
button2 = tk.Button(text="Next", font=40, command=next2)
button2.place(x=230, y=440)
#when pressing this button,variable nextt should change to 300, but it doesnt
root.mainloop()
Я уже пробовал с nextt.set = 300 и / или nextt.get (), все возможные комбинации ...