Forum Archive

React to a UI element inside `@ui.in_background`

halloleooo

When I put a UI element via @ui.in_background in the background, how can I react to the result in my normal (foreground) flow?

Say I have dialogs.list_dialog and I want to do something with the result of the list in my main function. Can I somehow wait for the result ?

mikael

@halloleooo, you can use the queue module.

If both the main and background code see the same my_queue = queue.Queue() (can be global, or passed as a parameter to the bg function), then your bg code can call my_queue.put(value) and your main code can wait for it with value = my_queue.get().

halloleooo

Thanks @mikael

Much appreciated your tip. I will try this. :-)

(Very strange though that I didn't not get any email notification about your reply... Does this forum not send emails out???)

mikael

@halloleooo, unfortunately, all email notifications, including password resets, have been broken for about a year now.

halloleooo

@mikael Good to know. Thanks!