Guide in Deskop Application Development in Python for newbies

Chris Warrick kwpolska at gmail.com
Sun Nov 8 04:22:01 EST 2015


On 7 November 2015 at 15:44,  <leonardmesiera at gmail.com> wrote:
> How do you start building a desktop application in python? I mean where do I start? Besides installing python on your windows what else do I need, and any suggestion on how do I accomplish this project.
>
> Right now I really want to finish this beauty pageant judging system which requires to have a client and a server, client would be for the judges and a server that computes the scores from all the categories, (i do hope you get I want mean by that project). I just finished reading Headfirst Python and I really loving this language, so any help from all the great programmers here would be so great.
> --
> https://mail.python.org/mailman/listinfo/python-list

This project requires two very different components, or one monolithic server.

The first one is the server. It basically needs to talk to clients
(via HTTP) and to a database. This is a trivial app to write in your
favorite web framework, eg. Django [0]. Come up with a good database
structure (read the excellent tutorial and documentation, should get
you there), write some models. But you can’t write your views just
yet. Because the views you write depend strictly on the client.

For the client, you basically have two choices:
(a) write a web application in Django;
(b) use a GUI framework and make a standalone desktop application.

If you choose option (a), you need to learn HTML/CSS and write the
views for your Django application (or use a ready-made front-end
framework, eg. Bootstrap [1]). This is the simplest choice, and it
takes a lot of work away from you. Your users will use their favorite
web browser to access the voting system, log in, and make their votes,
and there is no special setup for them (apart from giving them
credentials to access your app). Your Django views will use the
built-in Django templating, forms, and is relatively simple to do
(might even be doable in a weekend).

Route (b) is much more complicated. To follow this route, you need to
pick a GUI framework. There are also multiple options, I personally
recommend PySide, but you could also try wxWidgets, pygobject or kivy.
The web app side of things will require serializing data to JSON and
writing a RESTful API, but there are ready-made solutions for many web
frameworks [2].
But most of those come with a catch: they usually make you produce
ugly code, because they are wrappers around ugly C++ APIs. And then
you need to write code to talk to your HTTP server. You can’t use the
beautiful requests library, because it will block — so there’s more
work ahead, unless you want your app to be unresponsive every time you
talk to the server. For example, in Qt, you would need to use Qt
networking capabilities (which work asynchronously within the event
loop), or some other implementation that you can use asynchronously
(eg. Twisted, but then you lock yourself to Python 2, which is bad, or
threading, which has its limitations…)
And then you need to distribute your app to your users. Which is
already hard, because you need to coordinate Python, your GUI
framework, and your app. Are your users on Windows, Linux, or OS X? If
you have at least one person on a platform, you will need some sort of
testing environment…

And no matter which route you choose, you can’t do much without a
Linux server, so there’s more learning to do.

Sadly, developing big things is hard and requires a lot of knowledge —
especially if you’re a one-man-band.
Here’s a short list of skills you need, with a subjectively suggested
implementation and ease of implementation:

* understanding of the HTTP protocol (*)
* web application development (Django *)
* database schema writing (planning out the structure + Django ORM **)
* app server setup (uWSGI + nginx + Linux ***)
* database setup (PostgreSQL *** or something simpler[3])
* Route A:
  * HTML/CSS skills; a front-end framework (Bootstrap **)
* Route B:
  * RESTful APIs (Django REST Framework ***/***** if you use OAuth)
  * GUI framework (PyQt ****)
  * talking to your server from within the framework (****/*****)

[0]: https://www.djangoproject.com/
[1]: http://getbootstrap.com/
[2]: http://www.django-rest-framework.org/
[3]: If this is going to be VERY small, you could go with a sqlite
database, which requires zero setup, but which is not suited for
anything more serious.

Other learning materials:

https://uwsgi-docs.readthedocs.org/en/latest/tutorials/Django_and_nginx.html
http://www.fullstackpython.com/
http://deploypython.com/

On 8 November 2015 at 02:50, Michael Torrie <torriem at gmail.com> wrote:
> On 11/07/2015 12:15 PM, paul.hermeneutic at gmail.com wrote:
>> Where would you say that web2py <http://www.web2py.com/> fits into this mix
>> of tools?
>
> I am not familiar with it but I know it's supposed to be a lightweight
> framework for developing web-based sites and applications.  Could be an
> excellent tool for the OP to use to build his user interface.
>
> --
> https://mail.python.org/mailman/listinfo/python-list

web2py is weird, Django is more fun.

-- 
Chris Warrick <https://chriswarrick.com/>
PGP: 5EAAEA16



More information about the Python-list mailing list