0

What I am trying to do is make my text change after one second of staying as the first text.

import time
from tkinter import *

text = StringVar()

text.set("1")
time.sleep(1)
text.set("2")
time.sleep(1)
text.set("3")

textlabel = Label(master, textvariable = btn_text)
textlabel.pack()

I found that time.sleep does not work in tkinter, so I searched it up and found I should use after(). This is what I changed it to:

import time
from tkinter import *

text = StringVar()

text.set("1")
text.set.after(2000,"2")
text.set.after(2000,"3")

Yet when I tried that, I got an error message,AttributeError: 'function' object has no attribute 'after' and I cant seem to figure out what went wrong, so I would appreciate it if I could get some help.

Thanks :) -Jake

Jake
  • 772
  • 2
  • 8
  • 18
  • it would be helpful if you could tell me how to use it in my code above – Jake Jan 14 '17 at 15:07
  • `after` is universal widget method. Part of the problem may be that a `StringVar` isn't a widget. Its `set` _method_, certainly isn't one. – martineau Jan 14 '17 at 15:09

0 Answers0