[Ironpython-users] ShowDialog Hangs

Andrew Ayre andy at britishideas.com
Wed Feb 25 10:02:08 CET 2015


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


More information about the Ironpython-users mailing list