Official website for Linux User & Developer
FOLLOW US ON:
Mar
22

Build a Twitter client using PyGTK

by Kunal Deo

This tutorial shows how to use Python to build GUI applications very quickly. After an introduction to PyGTK you will learn how to build a simple, but elegant Twitter post client…

This article originally appeared in issue 85 of Linux User & Developer.
Linux User & Developer, one of the nation’s favourite Linux and Open Source publications, is now part of the award winning Imagine Publishing family. Readers can subscribe and save more than 30% and receive our money back guarantee – click here to find out more.

Resources:
You will need the following packages to be installed in your system:
PyGTK: Install PyGTK development packages. If you are using Ubuntu, install the package python-gtk2-dev.
python-simplejson: simplejson is an extensible JSON (JavaScript Object Notation) encoder and decoder for Python.
Python Twitter: Python Twitter library provides a pure Python interface to the Twitter API. You can download it here. Once you have the source file (python-twitter-0.6.tar.gz), perform the following steps to install it…

$ tar xvfz python-twitter*
$ cd python-twitter*
$ sudo python setup.py install

If sudo is not working for you, try logging in as root, using su and then run the steps.

Source Code examples:
HelloWorld and TwitPost
kde1

Traditionally, GUI application development has been complex. On top of that, it could only be done with compiled programming languages like C or C++. Actually, that is not entirely true: you could have used Tcl/Tk scripting language to build GUI applications. But those interfaces looked like how KDE1 was: very ancient.

PyGTK is a set of wrappers around the GTK (GIMP Toolkit) library. It lets you to easily create programs with a graphical user interface using the Python programming language. PyGTK gives you best of both worlds: the simplicity of the Python programming language and the power of GTK. GTK allows you to develop fully fledged cross-platform GUI applications. It also facilitates rapid application development using glade libraries.

PyGTK is used in many places. As far as Linux is concerned, you will find PyGTK powering many Linux distributions’ set-up tools; prime examples are Fedora/Red Hat – in Anaconda (the Red Hat installer) and various GUI administration tools – and Mandriva Linux (Drakconf-based tools). This is owing to the fact that Python in its own right is a great tool for administration-related tasks. PyGTK is also the official GUI toolkit for the OLPC (One Laptop per Child) project. It is used heavily in building netbook/tablet-friendly applications.

Pages: 1 2 3 4 5
  • Tell a Friend
  • Follow our Twitter to find out about all the latest Linux news, reviews, previews, interviews, features and a whole more.
    • Pingback: Issue 85 | Linux User

    • http://www.ibcscorp.com SEO firm Utah

      I’m python beginner and this post give me fine set of instructions to build tweet machine. Good luck and thanks for sharing