def post_ui(func): def func_wrapper(*args, **kwargs): Gdk.threads_enter() func(*args, **kwargs) Gdk.threads_leave() return func_wrapper