console module problems
AtomBombed last edited by
When I have a UI file to go with a program I am making, I usually try to implement the use of console functions like consol.alert(). But I can't do this because every time I do, it always gives me an error that says:
"AssertionError: Cannot show alert from main UI thread."
If anybody could help me out with this, it would be much appreciated!
Webmaster4o last edited by
If it's in a function, use
It should look like:
@ui.in_background def action(sender): console.alert("test")
JonB last edited by
instead of console.alert, consider using console.hud_alert. unless you need the user to press ok, using console.alert causes more problems than it solves!
if you DO need the user to acknowledge, you really want a "shield" over your ui, and implement callbacks. see the "confirm" method in gitui.py here:
the beta has a
dialogsmodule which implements some of these ideas as well.