This blogpost is by Geoffrey French, who has joined us for the Docs Hackfest which is happening this week at the University of East Anglia, Norwich, UK.
Kat invited me to write this guest post on her blog, describing my experiences of the Norwich GNOME Docs Hackfest held at the University of East Anglia School of Computing Sciences over the last few days. I joined the hackfest as I recently started using Gnome 3 after installing Fedora 20. My personal website is at www.britefury.com. I am the author of two interactive programming environments for Python; The Larch Environment and The Ubiquitous Larch.
My initial focus was on helping developers get started with developing Gtk+ v3.x apps in Python for the Windows platform. I feel that Windows is an important platform due to the large user base; being able to develop software for them can only be a good thing.
My prior experience with developing Gtk+ apps in Python was gained while developing gSculpt, a 3D modelling program. At the time (2008) I targeted Gtk+ v2.x using the PyGtk Python bindings. Since Gtk+ v3.x however, PyGtk has been replaced with GObject introspection based bindings for external langauges.
Luckily getting started Gtk 3.x development on Python for Windows is very easy; thanks to the hard work of Simon Feltman et al there is a nice installer package that does all the work for you! You can also use either Python 2 or Python3 as a bonus.
The first (if obvious) step is to ensure that you have Python installed; either versions 2.7 or 3.3 are fine. Next, you need to install PyGObject. You can download the Win32 installer here. You get a large 130MB installer which comes bundled with PyGObject Gtk, glib and many other Gnome libraries; so no need to hunt down dependencies. When you run the installer, you will be asked to choose a Python interpreter to install for (2.x or 3.x if you have multiple interpreters installed). Next, you can choose the packages that you want; ensure that you select Gtk at least.
After that, you are good to go!
If you want to learn Gtk using Python, the Python GTK+ 3 tutorial would be a good place to start.
Writing about it
After finding out that getting going was so easy – and noticing that this fact was not immediately obvious – I decided that it would be good start to write about it, so that people can find this out.
Since I was going to be working on Windows, it seemed to make sense to try to write Mallard documents on Windows too. Unfortunately, getting Yelp installed was not nearly so easy. I regret to say, that after installing MinGW, some circular dependencies involving pkg-config and glib caused me to give up.
The Hackfest
I found out about the hackfest shortly before it was due to start. I decided to join and was greeted by welcoming and friendly faces who helped me get started quickly. I am happy to have met everyone and I hope to collaborate with them again in the future!
That’s nice to read! I always wondered why PyGtk is still targeting GTK+ 2.x, but being deprecated by Introspection makes sense of course.
Do you have any advice about packaging Python/GTK+ applications into easy installers for people who are not developers?
Marius,
Not really; I haven’t got that far 🙁
Several years ago (c 2007), for gSculpt I used py2exe to build a basic exe file. It would contain what it needed of the Python std-lib, but would not pick up gtk, etc. To address this, I wrote a Python script that would generate an XML file that would tell the WiX installer generator to gather all the files together and generate an MSI. This worked with PyGTK. Whether py2exe will work with the new introspection based bindings I am not sure.
Looking at their site, py2exe has installers for Python 2.5 through 2.7. For 3.x, I do not know the state of play.
I do seem to recall that the process involved in getting to the point that I could create an all-in-one installer was quite circuitous.
Is there an installer for 64 bit windows anywhere ?
Stu, unfortunately I am not aware of a 64-bit installer; seems like 32-bit only for now. 🙁