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!
“What? Another section on how to install and download things?”, you may wonder. I have to. I presented this article to not also intermediate readers, but also to complete newbie out there. So, here goes:
- Install Python 2.7 from this download page. If you install it in its default location (recommended), also add this path : C:\Python27 and C:\Python27\Scripts to Windows Path environment variable.
- Download PQt4 from this site. It will automatically install itself (and automatically add it to Windows path variable) in this location : C:\Python27\Lib\site-packages\PyQt4. It will be needed for PyCharm to open *.ui files which are Qt form file definition
- Download PyCharm (either the free Community Edition or 30 days trial of Professional Edition) from this location. Actually this is optional, but if you want to follow closely this tutorial, I suggest that you use this awesome Python IDE from Jetbrains. The community edition is just fine for this purpose.
If this is your first try with Python, after all prerequisites was installed correctly, try to run PyCharm and try to create a new blank project.
Create new Python blank project
Create a new Python file,
Create new Python file
Named it main
Add this single line of code:
[code python]print(‘Hello Python!’)[/code]
Run it by right clicking on blank part of the editor or the
main.py node in Project View, and choose : Run ‘main.
If you see this in your console,
Great! Everything working just fine!
Congratulations! This is your first Python application ever created!
Don’t worry for the dumbness of this application.
As I said, I not also targeting intermediate Python readers, but also to total newbie out there. I am trying to create a wonderful learning experience by increasing your confident in Python programming step by step.
Everything will progressing great in the next subsequent articles.
PS : Oops… Did I forget something? This is the Github repository for this project: pythonthusiast/Northed.