the thpinfo.com blogger archives (2007-2008)
PyGTK applications on Windows
Tags: win32, porting, python, pygtk, gpodder
One advantage that you automatically gain when writing Python programs is that they are portable to several other mainstream operating systems (although there are some problems with specific extensions, etc..).
So, after releasing gPodder 0.10.0, which has now only one strict dependency on a pure Python module (feedparser), I wanted to try out if I could get gPodder running on Windows (I have tried it once before, but back then I was spawning a wget process to do the actual downloading, which was kind of awkward on the Windows platform).
What you need to get this working is Alberto Ruiz' All-in-one PyGTK Win32 installer and a check-out of the current SVN trunk head of gPodder. To check out a working copy from a Subversion repository on Win32, you can use TortoiseSVN.
I've found some divide-by-zero errors that I didn't see happening on Linux, so I could quickly fix them in our Subversion repository. I also got rid of some old symlinking code that I didn't use anymore, because symlinks on Windows isn't really possible (except for Vista maybe). Other than that, there were just some minor problems with my code being Unix/X11-specific, for example I'm checking for the $DISPLAY variable in the main script, which isn't needed on Win32.
There were other minor annoyances which I haven't dealt with yet, but which don't interfere with the basic functionality of gPodder:
- Running .mp3 or .avi files with the preferred media player (how do I do that on Win32?)
- Getting a GTK Icon Theme into my GTK installation, so all icons in gPodder display properly
- Removing the GUI for iPod synchronization (or get libgpod + Python bindings working on Win32)
- Testing, testing testing :)
I wonder if it's possible to use Py2exe
to create a nice, self-contained Win32 package of gPodder that has Python2.5, the GTK runtime, PyGTK and python-feedparser integrated and works without installing anything.
Morrighu Tel Uvrith (2007-10-28T17:16:00.000+01:00)
We’re an open source gaming engine project that’s looking for python devs. If you or anyone you know is interested, please visit us at www.projectangela.org.
I have been making stand-alone exes with pygtk for a couple of years. It is not complicated. All you have to do really is copy the whole \bin \lib \share directories into your project folder and to have a line in your python script before the import gtk that does
to point to the correct path.
I did a python podcast retriever, orm, which is on berlios. I haven't touched it for a while, but there might be some stuff to use from it ... there was a start of a curses gui :)
Hi. I am really glad to see PyGTK applications on Windows. I use them a lot, and usually without problem.
About the question of using py2exe to make executable environments, I blogged this at:
Tim Golden (2007-09-26T11:48:00.000+02:00)
To answer your question: "How do I get an .mp3 or .avi to start with the associated app?", the most straightforward answer is: use os.startfile (or its under-the-covers equivalent ShellExecute).
If you want a little more control, you can determine which app. that would use by using the FindExecutable API:
I *believe* (tho' I haven't used it) that the desktop module:
covers this kind of thing x-platform.
Thomas Perl (m at thp io); jabber: email@example.com