A little more IronPython

Published 2009-08-18 on Farid Zakaria's Blog

Working my way very slowly through IronPython in Action, and so far it is pretty neat. Probably the craziest thing is building a GUI application using the interactive console. However in order to get the most of out that joy, the interactive console must be placed on a separate thread. Normally it is on the same thread as the GUI thread causing it to lock up since the Form is in a continous loop.

The IronPython distribution provides a sample script winforms.py. Winforms specifically places the console on a separate thread to play around with the GUI interactively. With winforms imported, you can display the form by calling form.Show () rather than Application.Run (form).

Making changes to the GUI during runtime makes me smile


IDE


I find an important IDE crucial in learning/using a language. Most people I speak to try to persuade me otherwise telling me it is more of a crutch and that I should perhaps stick to basic text editors (ex. VIM). For example; it was a joy to use VS2008 in learning C# (especially the visual editor). I cannot imagine doing most of the work I did without the visual editor and Intellisense. Therefore I set on a search for an IDE to learn IronPython as it is currently not supported in VS (hopefully 2010).

A somewhat quick long browse through the web resulted in me experiementing/investigating the following options:

  1. IronPython studio

    Initially I was excited to see a build of Visual Studio (using the VS SDK) that includes IronPython support. However I quickly discovered that it doesn’t work with IronPython 2.6.

  2. Eclipse

    Rule #1 I learned is to always check Eclipse for a plugin for a lanaguage I’m learning and most of the time there is great support for it. This was true with respect to IronPython and Eclipse does have a plugin for IronPython support. Best of all they included auto completion for most of the .NET libraries which I’ve been reading is somewhat difficult to do given that most of the type checking is done during runtime. The two drawbacks I noticed is that :

    • No Debug support
    • Takes a while to launch script
  3. I looked into some more lightweight options which mainly focused on a simple good text editor.

  4. Notepad++

    I’m a fan of Notepad++. I install it on every machine I use, since I find it to be a very great lightweight but highly extensible editor. Although it has no native support for IronPython, the Python language support was enough to make it useable.

  5. Davy’s IronPython Editor

    This one caught my attention because it is an editor written in IronPython and it is very lightweight. It is still in development so some features seem to be incomplete although it gets the job done nicely.

In the end I decided to go with a more lightweight approach since I am sticking to smaller scripts. The IronPython tutorial (included with the distribution) includes help for setting up on using VS to debug IronPython or using the CLR debugger.

Time to pick up the pace...