Re: wx.FileDialog and scripts


My driver IBMTTS launch a file dialog from the configuration settings,
it shows a category in the NVDA settings dialog.
You can use that add-on as reference.

But I have a personal add-on that launch a file dialog from a script,
I did not publish the add-on because is just for personal purposes,
but see the code I used here. This is the function called by the

def setFile(self):
d = wx.FileDialog(gui.mainFrame, message= _("Select the text to show
in the document loader"),
# Translators: the label for the text document extension (txt) file type
wildcard=(_("text files (*.{ext})")+"|*.{ext}").format(ext="txt"))
def callback(result):
if result == wx.ID_OK:
text = open(d.GetPath(),encoding="utf-8").read()
self.document = SimpleTextResult(text)
self.documentUi = CustomTextUi(result = self.document)
gui.runScriptModalDialog(d, callback)

David CM.

2022-08-21 3:42 GMT-06:00, Javi Domínguez <fjavids@...>:


Does anyone know why I can't use a wx.FileDialog in a globalPlugin
script? NVDA crashes. However, elsewhere, for example calling it from
the NVDA menu it works perfectly.


Join { to automatically receive all group messages.