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.
List Dialog Returns None
-
self.var = str(dialogs.list_dialog(title='Select a file type', items=[".txt", ".py"], multiple=False)) print self.var
Returns none when I select an item, any ideas why?
-
Possible reason: You're calling this from the main UI thread (e.g. from a button action etc.). Blocking that thread would effectively "hang" the app, so
list_dialog
returns immediately, without waiting for a return value.Try decorating your action/function with
@ui.in_background
, like this:@ui.in_background def my_action(sender): self.var = str(dialogs.list_dialog(title='Select a file type', items=[".txt", ".py"], multiple=False)) print self.var
-
@omz That was it, thanks. You could tell it's been a while!