Categories
Python

Building GUI with Python and Tk

I have been looking for a decent GUI toolkit to develop some desktop programs. I worked with Java. Didn’t like the idea of typing that much to develop a app. Used php with WinBinder and PHP-GTK. Liked the first one, but the binary I have won’t load the winbinder extension. To use it, I will have to go back to php4. Again I don’t like the idea of using php4 for GUI while using php5 for web development. So again I had to make a swtich. This time I went for wxPython for Python 2.6.0. Alas, though wxPython used to work fine on my XP, it no longer runs on Windows Vista.

Finally, I deceided to work with TK which comes pre-installed with Python. The IDLE, Module Docs and other GUI tools which comes with a standard Python installations are most often developed using TK on Python.

I liked TK quite a bit because the process of developing TK GUI apps are damn easy and great fun. While learning TK, I converted my old console twitter publisher to a TK powered GUI app. Here’s the sourcecode:

Python 3 Source Code:

It’s very comfortable to work on TK. Write less, do more. A good set of widgets and a powerful language like Python as the backend… It’s simply cool 🙂

Categories
Python

Simple Console Clock for Windows with Python

The code is self explanatory:

Python 3 Source Code:

It displays a clock on Windows Command Prompt and updates it every second. It mainly demonstrates the Timer object of threading library.

Categories
Python

Python tool to expand short URLs

In one of my last posts, I posted a code snippet which demonstrated how to use php to expand short URLs to their original long form. Here’s the Python version I coded a few minutes ago.

Python 3:

These codes are for Python 3. The tool was developed for CLI use.