Python/Tkinter: Update button from every second -


i'm trying start thread (without understanding threads are) call function different python file every second, , set label's text attribute str returns. result a label every second updated show current time. use while true loop stop succesive code running, including tkinter's tk.mainloop(). i've seen lot of questions topic on haven't gotten solution work far.

what python method can start process continually calls external function? , should before or after mainloop()? mainloop() loop doing? python program continues yet somehow tkinter still able check events?

running python 3.4

this how i'd it. no, i'd wrap class , instantiate class i'm stealing whole-cloth the linked question

import tkinter tk import customfunc  def run():     root = tk.tk()     s_var = tk.stringvar()     tk.label(root, textvariable = s_var).pack()      def update_time():         s_var.set(customfunc.func())         root.after(1000, update_time)      update_time()     root.mainloop()  if __name__ == "__main__":     run() 

Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -