Forum Archive

console.alert makes screen unresponsive when called from within form_dialog window

Grun6

Hello,
I am running into the following problem: when I call a console.alert() from within a form_dialogs, the screen freezes completely and becomes unresponsive. Is there a way around it?
To illustrate:

import console, dialogs 

fields = [{‘type’:’check’, ‘key’:’testing’, ‘title’:’atest’ }]
dialogs.form_dialog(fields = fields)

And in the dialogs.py module, in the tableview_did_select function, right under if t == ‘check’, add:

console.alert('this','is','a','test')

Any help is much appreciated,
G
```

JonB

try using @in_background

Grun6

Yep I've tried but it pushes the window prompt behind the form_dialog window and makes it unusable.
Would you be willing to have a look at it, I could send you my files/github repo to run on your side.
Thanks,
G

JonB

Right. forgot:
https://forum.omz-software.com/topic/1119/can-t-show-an-alert/11

use console.hud_alert for simple notifications.

Alternatively, you might need to use a thread, or maybe dismiss the dialog first -- cnsole.alert doesn'tplay nice with wait_modal.

Alternatively, you can attach your own view to a "shield view".

Grun6

Thanks for the suggestions. I will try them !