Time pulse tkinter python

Viewed 77

I have a code that change the Image. Ive used .after but i want the time (3000ms) adjusteble by a data entry. How can i do that?

muted3 = False
def mute_music3():
    global muted3
    if muted3:
        volumeKnop3.configure(image=volumePhoto3)
        muted3 = False
        root.after(3000, mute_music3)
    else:
        volumeKnop3.configure(image=mutePhoto3)
        muted3 = True

root.after(0, mute_music3)


mutePhoto3 = PhotoImage(file="C:\\Users\\evanh\\Desktop\\buttonimage\\Time_Done.png")
volumePhoto3 = PhotoImage(file="C:\\Users\\evanh\\Desktop\\buttonimage\\Time_Not_Done.png")

volumeKnop3 = Button(image=volumePhoto3, command=mute_music3, background="white", activebackground="White", border=0)
volumeKnop3_window = canvas.create_window(30, 200, anchor="nw", window=volumeKnop3)
0 Answers
Related