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!

 (More)



Part 3: [Addendum] How Python Organize Your Application Code

 

Modularization of Python Code (Image taken from here)

Modularization of Python Code
(Image taken from here)

I visioned that this article will be your first article in how to properly start coding in Python. And lets be brief in this: you are going to understand what does it means by the following three ways of organizing Python code:

  1. Module
  2. Package
  3. Class

All, through the eye of a Python programmer.

Those three terms are your fundamental key in understanding how to properly organize your Python application.

Great. Lets get started!

 (More)



Using Jetbrains PyCharm Community Edition for Your Python IDE

 
Great chance are, that you will going to love this cross platform Python IDE

Great chance are, that you will going to love this cross platform Python IDE 

As with any open source software development platform, Python was blessed (or cursed?) with myriad of ways to develop program written on it: "With what IDE/Text Editor should you develop your next killer Python application?". A free and open policy, does initiate and keep energetic programmers to stay awake in this awesome Python world. But for newcomer, choosing the right IDE can become a daunting task. Add that with the phenomenon of epic war between IDE/Editor community, and you may find your way to choose a Python IDE not as trivial as it is in .NET development: any Visual Studio contender anyone? Laughing

Hereby, I started a new line of series on this blog that specifically review Python IDE at my disposal. Although it's not easy to stay away from subjectivity of certain IDE, but I am trying to do so, by deciding several important features that must be existed in a Python IDE: its overall value will be increase if it posses these features.

This article will also serve as an important article for Python for Beginner series: I believe coding Python in an IDE will bring much more advantages for beginner out there. Great. Let's start the review with a cross platform IDE : PyCharm from Jetbrains. (More)



Part 2: Reviving Microsoft Agent using PyWin32 - Run the Agent Hourly

 
Now the agent can run in specified time interval

Now the agent can run in a specified time interval

If you inspect closely our last article, you will realize that the Agent although having the ability to speak the time when you need it, it still unable to speak the time in specified interval, say, hourly. In this part of the article we are going to inspect whether we can easily add that ability.

Let's find out!

 (More)


Part 1: Reviving Microsoft Agent using PyWin32 - How to Make It Live!

 

I just found an MS Agent characters I haven't seen before, and though to share how to control them from within Python

I just found an MS Agent characters I haven't seen before, and though to share how to control them from within Python

I think this article was driven by the fact that this April, Microsoft discontinued Windows XP. And why is that related? Because if you remember Windows XP, somehow I think you will remember --maybe in annoyance-- this cute little dog called Rover from Windows XP Find Files bar:

Howdy, Rover?

Howdy, Rover? Not even you, now your master was also dead. So sad.. Frown

Long story short, Microsoft did not gain success with this MS Agent stuff. Without even realizing it, one of the first thing I do when re-installing Windows XP is ... get rid of Rover from Windows Explorer! And yeah, unfortunately, I am not the only one.

But still, in this article we are going to use it as a study case on how to properly use PyWin32, an amazing Python package from Mark Hammond, that let your Python application integrate tightly with Windows. For example, do you know that Dropbox client application was built with Python? Laughing

Great, lets dig more on this matter!

 (More)



Pythonthusiast Redesigned: New Logo and Bootstrap UI

 

http://pythonthusiast.pythonblogs.com/gallery/230/previews-med/logo.png

I never forget the enthusiasm thrilling I get, when reading "Tuntunan Praktis Pemrograman C++ by Tjendry Heriyanto" book with reading position depicted in the above image. It was the most thrilling experience I had, back in my intermediate school in 1997. Yeah, the good 'ol day


 

Actually, I started this week by creating an article about what makes programming in Python different through the eye of a Java programmer. But as I browse through the content of this site, I realize that this site still lack of a better way of navigating the site. It still is a LifeType blog. And the truth is, I never like the default navigation experience brought by a blog: the usual orderly post layout, category/tag list, calendar with count of published article and so on. So, I took the courage to do thing that I am most frightened of: designing a web. Yeah, I never assess myself as a great web designer. It always suck my brain out!

But thanks to Bootstrap (mostly its 12-grids system), the process is much more easier than I previously imagined. With plenty of resources there available in the internet, finally I can come up with a web design that is not as pathetic as I think I will come up with. And thought to share it, as I know designing is an entirely different beast than coding.

Let's have a look!

PS: Foreword warning, please be aware that there will be some PHP/Smarty tags scattered in this article

 (More)



Python Cloud Computing #2: Practical Hands-on Using Heroku - Part 1 of 2

 
Heroku Office Entrance

Heroku Office Entrance
Pulled out the image from here.

 

This is yet another article in this series that shows a practical hands-on using another Python Cloud Computing solution there existed in our planet: Heroku. We will going to try to publish our Openshift's Flask Biography application in Heroku, and along the way --it's unavoidable-- we will compare the process with Openshift, which due to Openshift's generosity in offering 1 GB free plan (including database and user uploaded files!), I still think Openshift is the best Python Cloud Computing platform for developers out there. I got to remind you though, I am not talking in term of its performance comparison in handling multitude number of visitors. We are just going to find out how to create, deploy and manage application installed in Heroku. The branch that we are going to use, is the Blueprints branch in our public pythonthusiast/bio Github repository.

Great, lets get started!

 (More)


Python for Beginner #1 : Get to Know What This is All About

I wish I start coding at the age of ... 4

I wish I start coding at the age of ... 4
(image taken from here)

UPDATE: I have this interesting question by one of my blog reader, Riky Lutfi Hamzah, via email : "Sometimes, I find it difficult to focus when learning something, including Python. I am very interested in Python and web development, but when I tried to start, I always tempted by other languages​​. Is there anything else that you can show to me, of why I have to learn Python? And how to focus on Python technology to developing applications?". I answer this question in the last section of this article. Hope it helps!


After almost half year blogging in this cool Pythonblogs platform, I realize that I never take into account that some visitors maybe a total beginner to Python. Or even, a total beginner in software development in general. I think I am enjoying pouring all my experience in Python and rather neglect the thought, "What happen if persons who are totally new to software development, somehow got stumbled to my blog?". I realize this thought, when in my previous article is the first time I officially talk about what is Python module and Python package: I neglect a very important concepts of Python software development.

If you reading this, chance are that you are in your initial process of trying to master software development in general, or Python software development in particular. I will use this series to publish a very quick article, but still highly practical, that if applied, will help you master this broad topic of software development process. I am not a lecture, got to remind you though. But, I always have this keen interest of trying hard to transfer the passion of developing software and pour all of my gathered knowledge to anyone who have the potential to learn programming.

There will be a general concept of software development for sure. But Python will always be the main programming language being use to demonstrate the discussed concept. Although having said this, I may have a sidebar that talk how other programming language (that I know of) implement it. And, as always, I will make sure that each chapter come with a code example that you can clearly follow and test in your own computer.

Great. What are we waiting for? Let's do this!

 (More)



Flask Biography Tutorial Part XIV - Redesign The Application using Blueprints

 
Blueprints Modularized Version of Biography Application

Figure 1 - Blueprints Modularized version of Biography Application

In a retrospect, the intention that drive me in finishing this Flask Biography Application is because I would like to start a series that extensively talk about Python Cloud Computing. As I deploy the application in PythonAnywhere, I realize that the application structure is far from complete (I dare not to say perfect..). Back at that time, I throw all application's classes, object, method, configuration, etc, into a single Python file (or let's call it Python module. It's much more Pythonic that way). For the sake of simplicity, it's cool actually. But things will become seriously ill, if the application begins to grows.

In the previous article, we have done an initial work of restructuring the single application module into several modules and using Flask-Classy to better manage our routes/views method. But the restructuring work is not yet finished: you can't clearly see any separation of concerns (a.k.a application features) toward the existing application code. And that's where Flask Blueprints nicely fits into our discussion.Taken from Armin own writing, "Blueprints can greatly simplify how large applications work and provide a central means for Flask extensions to register operations on applications. A Blueprint object works similarly to a Flask application object, but it is not actually an application. Rather it is a blueprint of how to construct or extend an application". At the moment we won't talk about Flask Extension, instead we will obey Armin's word, that Flask Blueprints object, is blueprint (sorry for the blueprintception) to construct or extend an application. Meaning, to construct a large Flask application, one must use Flask Blueprint object in doing so. Coupled with the proper use of Python package and module, you will be able to construct a large Flask application in a much effective way.

Great, what are we waiting for? Let's go deeper!

 (More)


Flask Biography Tutorial Part XIII - Structuring Project to Support Larger Flask Application

 

Splitting main.py module/file into several *.py files/modules

 

If you have followed this Flask series until this article, you will know that up until now our Flask article still lived inside a single file: main.py. Is it a bad practice? Perhaps. But it really is fun. It is a proof that a web application can be contained within one single Python module, which is a realization of the initial April Fools Joke that drive the creation of our beloved Flask web framework: it's possible to create such, but certainly not advisable.

Having said that, Flask still don't impose any strict directory organization or modules separation. Compare this with Django, where it come up with a monolithinc ready to use project directory that you must adhere, in Flask world, you can freely to choose to follow a simple organization of your Flask application into package as this official guide shows you, or turning your Flask application into a highly modular application using Blueprints. In this article we are going to implement a much more simplified version of Flask project directory organization : splitting main.py module into several *.py files/modules that wrap logically related class/code into its own module. The idea is simple: e.g., if you want to add a new form, you don't have to scroll through the code that talks about models. In the next subsequent article, we will then modularize our application using Blueprints.

Let's get started!

 (More)


Flask Biography Tutorial Part XII - Implementing Profile Page using Inline Editing

Utilizing X-editable to edit biography page

Utilizing X-editable to in-place editing our biography page

UPDATED: Previously I said that I use wsgi/static/upload to store user's uploaded avatar. Although it's working, it still imposed one important problem: the content of wsgi/static/upload itself will be removed for each subsequent git push command. We must store user's data into $OPENSHIFT_DATA_DIR/upload directory. How do we do this? Simple. First, (if it's currently existed) remove the folder wsgi/static/upload, and then create an executable binary script within the folder .openshift/action_hooks/post_deploy, with the content: ln -sf $OPENSHIFT_DATA_DIR/upload $OPENSHIFT_REPO_DIR/wsgi/staticgi/static/. Make sure to set the flag bit into executable using the command: chmod +x post_deploy (I don't think you can do this in Windows. *nix/OSX will do just fine for this).This script will be run each time we push the repository to Openshift --after the application successfully deployed, making a link to upload directory of user's uploaded avatar. This way, user's avatar will get stored in $OPENSHIFT_DATA_DIR/upload and will always available each time we push our application to Openshift.


As I start a new series on this blog about Python Cloud Computing and working my first way of making our Flask Biography Application runnable within PythonAnywhere, I realize that I haven't completed the last important thing for this application to be fully functional: editing biography for registered users. This biography application will become practically useless if users don't have the ability to edit their full name, tagline, avatar and short biography. Having said that, let's make it even better by implementing in-place editing for all those fields, where in-place editing simply means users will be able to edit those fields directly within the same page. We are going to use Vitaliy Potapov's X-editable for this purpose. It's an awesome Open Source product!

 (More)



Python Cloud Computing #1: Practical Hands-on Using PythonAnywhere

Pythonanywhere unique online working environment

PythonAnywhere simple and unique online working environment

My first series in this blog was about Python Cloud Computing: developing Flask application and using Openshift to properly manage and deploy it. This is a series that bring another possibility: why don't I complete this blog with practical hands-on using another Python Cloud Computing solution? The internet is filled with this Platform as a Service solution. Some specifically state that they are Python only solution, other are much more general and open in nature. Having practical hands-on on the usage of some of them will add another advantage to this blog. Although, I am not sure that I can dive to all of the existing Cloud Computing/PaaS solution. For the most part, I will be unable to explore at the fullest on cloud solution that require actual billing to use important features such as database access, e.g Google Cloud or Amazon Web Services. In this regard, I really love Openshift way of attracting developers to use their platform: a 1GB storage including user uploaded files and database. I don't think there are other PaaS solution out there that can surpass this free offering.

Well then, lets start at our first stop : PythonAnywhere.

 (More)



Site News : Introducing Pythonthusiast's Dropbox Public Folder

Public Folder for Pythonthusiast's Tutorial Source Code. Get it here!

Public Folder for Pythonthusiast's Tutorial Source Code. Get it here!


This is maybe a late action I take regarding an appropriate way to share public artifacts of tutorial series in this blog. Surely you can follow Pythonthusiast's public Github repository, but you can also directly download its zipped source code at certain tutorial step. Previously, I simply throw them in my Bio application static folder, git add/commit/push to made them available online and then use their static link in my articles. It's a quick (and dirty) way, but certainly not the best way there is. For example, once I would love to finish my Flask Bio Application (I still have two/three more articles left), I got serious issue on trying to git clone it to my other working station : I have to download all that zipped source code too!. And I start to think, "Why oh why I don't use DropBox for this?".

And there you go : a nice public folder for all Pythonthusiast's tutorial series artifacts.

Stay tuned!

 

 



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!

 

 (More)


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

 (More)




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