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!
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!
Discipline, I say! - 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:
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!
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
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.
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!(More)
Welcome to the First Series of Tutorial on PyCocos2d-x Development!
Okay, for a quick background, you may skim on my previous article : How to Choose The Best Python 2D Game Engine?. I pointed out, "Although currently I am working with the Cocos2D python version, I am flirting Cocos2d-x due to its wider target platform". And my experience on working with Cocos2D Python was really impressive, but sadly .. it didn't satisfy my requirement. I need to develop an isometric game engine for my current Python teaching aid for kids, ProgrammedMe. And the current Cocos2D didn't support isometric map type that I longed for. I have tried to implement it actually, but as the forum itself is not that active (or may I say rather freeze?), I don't think I want to pursue my exploration in the Cocos2d Python field. Another reason is also about Cocos2D that only targeting desktop platform, which is a deal breaker for me (would love to develop for Android/iOS!). So, a natural direction would be to explore Cocos2D-x and try my best to implement a Python binding for it. Once it's settled, I can start developing ProgrammedMe using the aforementioned binding, named PyCocos2d-x.(More)
Copyright(c) 2014 - PythonBlogs.com
All rights reserved