Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
console.alert freeze
-
Hello Guys,
I got an Problem with console.alert...
i have my mainView = ui.View
and another NavigationView with another ui.View
both in .present('fullscreen')what did i wrong with console.alert to use in the NavView...
or is this not Possible ?console.alert('INFO Datensätze', f'Der Hersteller:\n[ {self.MANUFACTURER} ]\nhat nur noch [ {max_use - in_use} ] Freie Datensätze!\n[ {area_from} - {area_to} ]', 'weiter', hide_cancel_button=True)
console.hud_alert don't work because the view is to small... for the
\n
maybe you guys have an idea how to solve it
-
How are you calling console.alert? From within a button callback? Does your main view have a wait_modal? Is your button callback wrapped with ui.in_background?
See
https://forum.omz-software.com/topic/1119/can-t-show-an-alertConsole.alert cannot be run on the main thread, so would need to be done within a background thread. If you have other in_background items, waiting for a response, these will conflict with the alert.
Another good option for this sort of thing is a "shield view" -- a partially transparent view (bgcolor includes a low alpha value) that sits on top of your main view (booth children to the same root view), to which you can add other view/dialogs/whatever, without affecting content in your main view.
https://forum.omz-software.com/topic/1563/shield-a-class-for-blocking-touch-events
And in action:
https://github.com/polymerchm/ccMVC -
@JonB Thanks for your reply...
ui.in_Background is the solution... i missed it :(
-
you just have to be a little careful with in_background, and understand that it does not spawn a new thread, but appends the code to a queue, the same queue that the main script is using, and everything gets run in order.
so, if you had some blocking code at the end of your
__main__
, or some long running background task, like a timer, any new calls wont show up until the old calls are complete. -
sry for the late reply.
Yeah i know now ^^ but that's fine.. in the same function is only an hud_alert for 4sec and that's okay :D
-
This post is deleted!