I have a strange issue with TKinter after()
method. I'm calling function func_a()
(blocking call that takes some ms) in main thread and func_b()
in after()
to read a value at regular interval. It works like a charm, I can get some updated value during func_a()
execution
I do not need any graphical interface, so I do not use anymore TKinter, now I'm calling func_a()
in main thread. I create a separate thread to call func_b()
. The issue is that the call to func_a()
stops the execution of func_b()
separate thread. I need to wait for func_a()
returns to have some periodic call of func_b()
. I do not have source of func_a()
and func_b()
(python C bindings). But maybe some thread locking mechanism prevents func_b()
call when func_a()
is called.
The question is, what is implemententation behind tkinter after? How can I achieve same behavior as Tkinter after()
: be able to call func_b()
when func_a()
is called, without using TKinter?
Code looks like that :
pos_th= threading.Thread(target=read_pos, args=(0.1,))
pos_th.daemon = True
pos_th_stop = False
pos_th.start()
func_a()
def read_pos(period):
while not pos_th_stop :
func_b()
time.sleep(period)