vimalkumar.in

/blog

Beginning PyQt (Tutorial, PyCon Ireland 2011) - Slides and Code

Tutorial delivered at PyCon Ireland 2011.

This was a quick introduction to developing a GUI to a command line program using PyQt. I used the sphinx-build command from the Sphinx documentation project as an example.

The basic command for generating HTML documentation from source files is

1
sphinx-build sourcedir outdir

A GUI(dialog) was designed using Qt Designer to replicate the functionality of the command above. This was then converted to Python code and then a main application was written to make use of the dialog.

sphinx-build-qt dialog

Slides for the talk: slides.pdf

Code repository: https://github.com/vkvn/sphinx-build-qt/

You can clone the repo using

1
git clone git://github.com/vkvn/sphinx-build-qt.git

and checkout like this

1
2
cd sphinx-build-qt
git checkout pycon

This code works unaltered on Windows too. Thanks to Qt! You would need to have the C:\Python2*\Scripts in your PATH or wherever you’ve got sphinx-build installed.