Re: [Ironpython-users] ShowDialog Hangs

2015-02-25 Thread Andrew Ayre
Thanks. I've added a call to Application.Run() and also this: ExeThread.SetApartmentState(ApartmentState.STA); Seems to be happy now! Andy On 2/25/2015 8:47 PM, Andrew Graham wrote: > Not really strange, expected behaviour in fact. The Form is drawn OK but > there is no message loop running on

Re: [Ironpython-users] ShowDialog Hangs

2015-02-25 Thread Andrew Graham
Not really strange, expected behaviour in fact. The Form is drawn OK but there is no message loop running on the thread to pump messages to it so it will be unresponsive and sit there until the thread exits. A modal dialog, or Form shown modally, tries to pump the message queue itself, that is

Re: [Ironpython-users] ShowDialog Hangs

2015-02-25 Thread Andrew Ayre
Thanks for the responses. Strangely the following script works: import clr import time clr.AddReference("System.Windows.Forms") from System.Windows.Forms import OpenFileDialog, DialogResult, Form F = Form() F.Show() time.sleep(5) This displays a form and then closes it when the script ends after

Re: [Ironpython-users] ShowDialog Hangs

2015-02-25 Thread Slide
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 wrote: > I am sure I am making a silly mistake somewhere. > > I have IronPython embe