Thursday, May 20, 2010

Learn Quickly Creating Professional Looking Desktop Application Using Python - Part 2 of 7

Installing and testing our installations

Quick links to other parts of this blog series:
Part-1 | Part-2 | Part-3 | Part-4 | Part-5 | Part-6 | Part-7 

Basically, all the 5 programs we needed for this tutorial (as listed above) have fairly simple installation procedure. Generally all you have to do is download the Windows Binaries respectively and run it to install on your PC.
Note: you most install “Python” first before installing “wxPython” and “Py2exe”, because they are both python’s extensions/libraries.

Now let’s be sure that all we have installed are working perfectly;
For wxFormBuilder and InnoSetup Compiler, you should see their icons on your desktop or windows start pane. Launch the programs to be sure they are working!

For Python 2.x, wxPython, and Py2exe; you will have to follow the procedures below to verify they are installed properly.

~~ Open command prompt and type python and hit enter. If you got error like on image-1 below, then python is not recognized on your PC. Now do any of Option1 or Option2
~~ Option1: assuming you installed python on this path “C:\Python27” run this code below on the command prompt to fix it automatically (note: if your path is different, replace to the correct path).

[Environment]::SetEnvironmentVariable("Path", "$env:Path;C:\Python27", "User" )

~~ Option2: If Option1 above didn’t work for you, add the path manually as follow; open your computer’s “Control Panel” and follow 1-6 as shown on image-2 below (i.e.: Control Panel > System and Security > System > Advanced system settings > Advance > EnvironmentVariable...).
~~ On the window that opens after clicking “EnvironmentVariable...”, select “Path” then click on “Edit” and add your python path starting with semi-column as shown on image-3. Then click on “Ok” three times to apply the path.
~~ If all went well, retyping python on the command prompt will open a Python Shell as shown in image-4 below.

Still on the Python Shell, to test for wxpython and py2exe installations just type import wx and hit enter then type import py2exe and hit enter. If no any message is displayed as in image-5, then you are good to go your installations are in order.

Thanks for reading!

If you can't wait for the next blog post, download the completed tutorial as a .pdf file from this link:

Learn Quickly Creating Professional Looking Desktop Application Using Python - Part 1 of 7

I have done this tutorial series elsewhere, but now I decide to repeat it on my blog.... This post is the part 1. Enjoy! 

Learn Quickly Creating Professional Looking Desktop Application Using Python2.7/wxPython, wxFormBuilder, Py2exe and InnoSetup Take your ability to develop powerful applications for desktop to the next level today.

Quick links to other parts of this blog series:
Part-1 | Part-2 | Part-3 | Part-4 | Part-5 | Part-6 | Part-7

This tutorial will show you how to design and build a fully-functional desktop Graphical User Interface (GUI) application for maths Expression Evaluation using a combination of Python 2.x, wxPython, wxFormBuilder, Py2exe and InnoSetup Compiler. The app we will build is going to be a mini calculator that can perform valid Mathematical Expression Operations of addition, subtraction, multiplication, and division.

First of all, I will use python syntax (leveraging on the eval() python function) to make a Console/CLI (Command Line Interface) program, then convert it into a Graphical User Interface (GUI) app so that users have much more control of it.
I will use the CLI program to explain some python basic syntax for those who may be struggling with understanding of the python basics.

If you feel you need to learn/refresh your python knowledge, then I recommend reading this book “A Bytes of Python” by Swaroop C H.

By the way, some popular software vendors using what we are about to learn to power there software include;-,,, and (Source:

Basic requirements for this class are:-
~ Basic knowledge of Python programming – I will do my best to simplify the process of this tutorial as much as possible, so everyone will be able to follow along.
~ A Windows Operating System (OS) machine (other OS users can follow along as well) - I am using 32-bit OS computer using the Windows-7 operating system.
~ Python2 interpreter, Text editor, wxPython library, wxFormBuilder, Py2Exe, and Inno Setup Compiler – I will show you how to get and install all of these software soon.

Before we start installing and configuring the software we will be using, let me quickly explain what each of them will be used for and where to get/download them;-

Python 2.x interpreter
Python is an easy to learn, dynamic and powerful modern programming language. Two similar but incompatible versions of Python are in widespread use (Python2.x and Python3.x). Pls note that we will use Python2.x for this class, download the version for your OS below.

wxPython is a free GUI toolkit which can be used to build Python GUIs. It is a wrapper for the cross-platform C++ GUI API wxWidgets. Some other GUI library/toolkits for Python include; Tkinter, PySide/PyQt, Kivy and PyGTK

Py2Exe is a Python Distutils extension which converts python scripts into executable windows programs, able to run without requiring a python installation. Some other Python extension/library which converts python scripts into executable programs are; PyInstaller, Py2app, cx_Freeze, bbFreeze, and vendorID

wxFormBuilder is a free Python GUI constructor toolkit for wxWidgets GUI design which can be used to build Python GUIs. Similar python GUI constructor toolkits are wxGlade, Boa Constructor, PythonCard and wxDesigner

InnoSetup Compiler
Inno Setup is used to create installer for Windows programs. Similar programs are NSIS and WiX
Download link:

For sure, you also need a text editor if you don’t have one already, you can get NotePad++ at:

Hope you enjoyed this class? See you next time!

Friday, March 5, 2010

Welcome to my blog!

A Geomatics Information Technology and Python Programming Blog!

My name is Umar Yusuf. On this blog I will write about projects on Geomatics Information Technology (GIT) aka GIS and Python Programming Language, with more emphasis on QGIS, ArcGIS, PostGIS, wxPython, PyQt, PySide, SQLite, WxFormBuilder, QtBuilder, Web Mapping e.t.c

If you don't know what some of these things are, don't worry I will try to explain some of them now and as you follow this blog, you should get familiar with the rest gradually.

What is QGIS?
Quantum GIS (QGIS) is an open-source desktop GIS product that you helps you visualize, manage, edit, analyze, and compose maps with geographic data. QGIS runs on Linux, Unix, Mac OSX, and Windows and supports vector, raster, and database formats.QGIS is licensed under the GNU Public License. Read more about QGIS at: or

What is Python?
Python is a clear and powerful object-oriented programming language that lets you work more quickly and integrate your systems more effectively, comparable to Perl, Ruby, Scheme, or Java. Read more about python at:

What is PyQt?
PyQt refers to the Python bindings that wrap the C++ Qt libraries. That means we can now use Python to build Qt applications instead of learning C++.

What is wxPython?
wxPython is a GUI toolkit for the Python programming language. It allows Python programmers to create programs with a robust, highly functional graphical user interface, simply and easily.

What is SQLite?
SQLite is an in-process library that implements a self-contained, serverless, zero-configuration, transactional SQL database engine. The code for SQLite is in the public domain and is thus free for use for any purpose, commercial or private.

What is WxFormBuilder? is an open source GUI designer application for wxWidgets toolkit, which allows creating cross-platform applications. A streamlined, easy to use interface enables faster development and easier maintenance of software. It is written in C++.


Am going to be using the SyntaxHighlighter for Blogger with its shBrushPython.js. So if you see something like this code below, then know its a programming code!
def deRado(x,y):
    return x + y
    print "deRado fuction has finished running!"

Follow me as I share my thoughts on Geo-Data Science, Geomatics Information Technology, Remote Sensing Tools, Geo-Data Analytics & Visualization, Geospatial Application Development, GIS Scripts and Python Programming.

Happy reading