Part 4: Installing Prerequisites - Python, PyQt and PyCharm

Your first Python application for this series...

Your first Python application for this series...

Although in Part 5 of Developing Cross Platform Application using Qt, PyQt and PySide : GUI Application Development I already gave detailed steps on how to create Qt main window application, some readers still find it confusing. And someway I think they were right: that article was too confusing that it tries to compare C++ Qt, PyQt and PySide altogether. Some readers who asked me about how to start PyQt application, find that article is not much of a help. Therefore, in this article I am going to revisit that article and create a new one with this focus in mind : using PyQt 4, Qt Designer and PyCharm. I use Windows 8.1 to develop this application. For those who use other Operating System, feel free to adjust your working environment as needed.

The application itself, code named Northerd, as already mentioned in previous articles, is a productivity desktop application. It will sit in your system tray and assist you with any productivity tasks that I can think of and useful for my daily work.  It will have main window (of course), that how to build it, will be explained in great detail in this article.

If you are regular readers of this blog, I bet you have already know that the longest and completed tutorial series in this blog is the Flask Biography Application. What you are reading now, is future article series that will be in the same long and completeness as that Flask application. I hope you enjoyed this article series as much as you enjoyed The Flask tutorial series!

Great, lets get started!


Developing Cross Platform Application using Qt, PyQt and PySide : GUI Application Development - Part 5 of 5

Our Pythonthusiast Qt Widgets Application running in OSX 10.8.4 Mountain Lion

This part of the series is probably the essence (and the lengthiest!) of all articles in this series: doing GUI development using Qt. Although Qt develop itself as a full stack application framework, the association of Qt is always about GUI development. That's not entirely correct, as you can completely drop GUI part of the framework, and go only with the console. But, indeed the strongest part of Qt is mainly about GUI development : starting from desktop GUI using QtGui and now targeting mobile GUI using QtQuick. In this Qt article series, we still talk about desktop GUI development using QtGui modules. Although QtQuick future may cross QtGui area by maturing itself as another option to develop desktop GUI application, but QtGui will always be there as part of Qt framework.

To add a more interesting twist on this series, we will develop all of our applications in Apple OSX operating system (still using Mountain Lion 10.8.4 though, haven't upgrade it to Mavericks). Comparing it with the official Python/PyQt/PySide distribution for Windows, if done incorrectly, preparing a working environment of all them in OSX is a lot harder. But we will have a look on how it's done correctly : with the least effort as possible.

So, what are we waiting for? Lets start our first journey toward QtGui application development!



Developing Cross Platform Application using Qt, PyQt and PySide : Database Support - Part 4 of 5

Successful PyUnit testing of login feature from within PyCharm IDE

Successful PyUnit testing of login feature from within PyCharm IDE

Let me be honest about one thing : I don't have any draft outline for contents written in this blog. All of these articles were written in the spirit of improvisation and freedom to think/write/speech. For example, although I have been one of Qt fans since it was still owned by Trolltech, I have not the slightest idea that there will be a Qt series here. Even though I knew that Qt is supported in Python through PyQt, I am not that curious to start writing articles about it here. Only after I wrote this article, which lead me to Kivy that I began to experience something thrilling : doing Android development using pure Python! While I work on Kivy though, I also explore were there any alternatives to Android development using Python? Or in general, "Can we develop Android application without the use of Java?". The answer to this question bring me to (amongst other things) : Qt in Android. In which in Qt Project website itself, Python is listed as the most prominence third party programming language binding having Qt support! That was such a great news... Hence, our Qt series articles was born..

Another example is an answer around this question, "In this Qt series, what is the application that we are going to build?". Plain answer? No idea. Well, not that completely blind for sure. I just know that it must be a data aware application. And in the process of its development, it must be prefaced with a practical introduction to Test Driven Development(TDD). Combining both requirements, bring us to this current article : database support in either C++ Qt or PySide/PyQt. To keep things interesting, in this article we will officially use two IDEs : QtCreator for cross platform C++ Qt development and PyCharm for its Python counterpart.

Now that I have your attention ladies and gentlemen, lets drill on this cool talk about database support in Qt using either C++ or Python! Enjoy your time and .. happy reading! Laughing


Developing Cross Platform Application using Qt, PyQt and PySide : Test Driven Development and Unit Testing - Part 3 of 5

Discipline, I say! - Mark Pilgrim in Dive Into Python 3

Discipline, I say! Smile - Mark Pilgrim in Dive Into Python 3

Throughout my articles in this site, this is the first article that started without a fancy image : I started it with a quote from Mark Pilgrim's book, Dive Into Python 3, Chapter 9 - Unit Testing. There are two things that drive the decision to include this quote:

  1. Although my bachelor's thesis was about Test Driven Development (TDD) in Extreme Programming using Java, in my professional career as a software developer, it's seldom that I really develop application using TDD in mind. Most of the time,  after the initial requirement gathering, I brutally jump to design the application GUI using current IDE being used. Not entirely a bad practice, as sometimes user really need to quickly presented with the application interface, even though  it's a dummy one. But if things are not that hectic, it's always a good idea to start with the test-first programming/TDD style, as follows:
    • Create unit test of application features about to be implemented,
    • Run it and see it fail (because the feature is not there yet!),
    • Implement the features to make the test pass,
    • Refactor it to have a cleaner code and repeat the process until all features were implemented.
    The beauty of this technique is that, the core of your application features will not get intertwined with the application GUI (imagine having a login that coded directly to the login button. What if we want the login method to be executed from behind a Web API?). A code that follow TDD best practices will be a highly isolated and independent code. Which is truly a great thing, because as the application GUI design undergo changes through out its development, the features were already safe and kept in isolation.
  2. A user in reddit, replied in my post about how to best teach kids in programming with an inspiring comment, "I think we started writing python when they were about 13. And we focused on writing code well - unit test harnesses, data validation, etc from the very beginning". Although I have this vague idea in mind, I never really come close to apply this principles in teaching kids how to code. Exploring unit testing technique in C++/Python will surely be an important skill in my passion of teaching kids how to code.

Before jumping to the topic on how to build the application GUI with Qt using Qt Designer and use the resultant *.ui file into a C++ or Python application, I would like to preface it with an important concept in software development methodology : Test Driven Development and Unit Testing using either C++ or Python. To streamlined the discussion, I have already summarized the principles of TDD in the above passage, and not about to dive any further (except by giving credit to Kent Beck who developed/rediscovered the technique). In the rest of the article we are about to have a practical hands-on in developing unit testing code using either C++ (or to be exact using QtTest) and Python.

Let's explore it!


Developing Cross Platform Application using Qt, PyQt and PySide : First Iteration of The Overall Application Design and Hello World! - Part 2 of 5

First iteration application flow

Figure 1 - First iteration application flow

Special Note : I beg you pardon, that my subsequent Kivy article eventually must wait until after this Qt cross platform article being published. I found that, this Qt cross platform application to be somewhat challenging and interesting to discuss Smile

As the type of autodidact programmer who love to learn new programming language / framework / library by first thinking in global view of what my first application I would like to create, hereby I designed this tutorial with that principle in mind. The first application we are about to be build doesn't have to be a full blown application. But surely not a simple Hello World or an application whose its single purpose is to reflect the understanding of a one piece of this new things being learned. It should be complex enough to orchestrate many aspect of this new things, and by striving its completion, we will be in the right track of learning it fast. Surely we ought to start with the Hello World first, but while doing our Hello World application, we also have to have something rather complex application design in our mind. That's my two goals in this article : we are going to start with the overall application design and a guided Hello World application development for each of the technology : C++ Qt, PyQt and PySide.


Developing Cross Platform Application using Qt, PyQt and PySide : Introduction - Part 1 of 5

The blend of Qt in Python

The blend of Qt in Python
(Image taken from PyQT Wikipedia article)

Before we even begin this new article series, I would like to emphasize one thing : I would love to make this blog as a great starting point for you to learn many tidbits in Python software development. For example, even though what we learn is somewhat an advance topic in Python application development, I will always start with the basic. This eventually create a vast array of article series : Flask, Django, ProgrammedMe, Kivy, etc. The reason is quite simple : if you are new to a Python topic, you can always refer to the first article in a series to be able to follow the rest of the articles. 

In this new article series, the target that I want to accomplished is to introduce you to the Python Android application development using either PySide or PyQt. Yes, previously you have been introduced to Kivy to develop Python application in Android. But, before going even further in Kivy, lets have a comparative experience on Python application development using another libray : PySide/PyQt. This come with a requirement : you must be introduced to and able to develop a PySide/PyQt application in its Desktop environment. Then, we move to its Android development.This is necessary, as differ with Kivy that directly support mobile application development in its first inception, Qt support in mobile development was gradually introduced.

Great. What are you waiting for? Lets go!


Copyright(c) 2014 -
By using this website, you signify your acceptance of Terms and Conditions and Privacy Policy
All rights reserved