You need to make sure the thread was started as an STAThread I believe, otherwise the common windows controls (OpenFileDialog being one of them) won't work correctly.
On Wed Feb 25 2015 at 2:02:32 AM Andrew Ayre <a...@britishideas.com> wrote: > I am sure I am making a silly mistake somewhere. > > I have IronPython embedded in my C# WinForms application. > > The interpreter is running in a thread that has been created for it. > I.e. not the UI thread. > > Everything works fine until the call to Dialog.ShowDialog, at which > point execution of IronPython hangs and no dialog appears. > > I'm guessing that this is because the interpreter is not running in the > UI thread (which I don't want to do because sometimes scripts can take a > long time to execute, depending on what they are doing). > > This is my first attempt using WinForms from scripting in my application. > > Any hints or suggestions on how I can debug this, synchronize with the > UI thread or something else? > > Thanks! Andy > > import clr > clr.AddReference("System.Windows.Forms") > from System.Windows.Forms import OpenFileDialog, DialogResult > > Dialog = OpenFileDialog() > Dialog.ShowDialog() > > -- > Andy > PGP Key ID: 0xDC1B5864 > _______________________________________________ > Ironpython-users mailing list > Ironpython-users@python.org > https://mail.python.org/mailman/listinfo/ironpython-users >
_______________________________________________ Ironpython-users mailing list Ironpython-users@python.org https://mail.python.org/mailman/listinfo/ironpython-users