Skip navigation

Category Archives: Python

Python (both on and off the Web)

It is a truth universally acknowledged that not everyone is comfortable working with a command line. Let’s face it, some of our coworkers will never get over their desire for a good 5-cent GUI.

We’re a Ruby (and Java) shop here at work, so after I learned Ruby and started writing some serious scripts, I looked for a GUI toolkit for Ruby. Sadly, I found the available alternatives lacking for one reason or another.

Shoes looked good at first glance, but when its creator dropped out of programming, the Shoes project grew stale.. More recently, according the The Ruby Way (3rd edition), work has resumed on Shoes, but in JRuby. Maybe it would be worth taking a new look at Shoes, since we use JRuby here.

I also looked at Tk, but when I last checked, there were holes in the Ruby implementation (the Python implementation was more complete).

Qt is another popular toolkit used in Ruby, but the licensing (for commercial entities) caused me to pass on it.

One of the things I looked for was support built-in — either built-in to the programming language (so it’s all part of the same install), or built-in to the operating system itself (Windows, in our case). For a while, I played with the idea of scripting in Python, so I could use its superior implementation of Tk — but the needs of the many (possible users of any scripts I might write) outweighed the needs of the few (programmers who could maintain Python scripts in a Ruby shop).

Lately, my inclination has been to use PowerShell to run Ruby scripts, and this extends to writing GUIs. PowerShell can build GUIs using either Windows Forms (the old and busted way) or Windows Presentation Foundation (WPF).

Here are a couple of links to building GUIs using WPF:

Of course, when using PowerShell, it’s also a good idea to remember the Out-GridView cmdlet, which might be all the GUI some scripts need.

I’ve been studying Python for several years, off and on, but I’m only now getting traction on applying it at work.

One of the things I’m struggling with right now is how best to arrange the directory structure when using object-oriented design where some objects inherit from others, when I’m doing the development on my desktop machine but plan to move the project to a common network directory.

I found a post on Stack Overflow that referenced a post by Jean-Paul Calderone: Filesystem structure of a Python project – the Stack Overflow post got over 100 upvotes, which is a pretty good indication that Calderone’s structure is a good and reasonable one.

Maybe what I want is a relative import, as in this Stack Overflow post – but I can’t seem to make it work with my code just yet. Grrrr…

I thought I bookmarked this a long time ago – apparently I didn’t.

O’Reilly’s Test-Driven Development with Python (by Harry Percival) is still available to read online at the O’Reilly Atlas site (formerly O’Reilly’s Chimera Labs, if I remember correctly and if the URL is any guide).

Percival’s book was made available to read for free courtesy of O’Reilly’s Open Source Convention (a.k.a. OSCON). Since my budget is currently limited, I’m very happy for the opportunity to read this book without having to buy it (or keep checking it out of the library).