Issue
I am actually doing a program with tkinter.
I am trying to do a window log, like windows when you transfer a big directory.
I am desperately trying to do that every second a string of my list is printed on the text page.
and it says NameError: name 'n' is not defined but I have used the global
method, so normally it should work...
here's my code:
n = 0
def refresh():
global n
write(thingstotestlist[int(n)])
n = n + 1
if n > len(thingstotestlist):
return
textbox.after(1000, refresh)
textbox.after(random.randint(500, 1000), refresh)
please help me
Solution
Move your global statement above as so:
global n
n = 0
def refresh():
global n
...
Answered By - roman_ka
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.