Considerations for python gui toolkit for app that queries remote database? [closed] Considerations for python gui toolkit for app that queries remote database? [closed] tkinter tkinter

Considerations for python gui toolkit for app that queries remote database? [closed]


Welcome to a fun area:

  1. Watch out for urllib2: it doesn't check the certificate or the certificate chain. Use requests instead or use ssl library and check it yourself. See Urllib and validation of server certificate Sometimes a little ZeroMQ (0mq) can simplify your server.

  2. You should consider shipping a self signed certificate with your application if you are a private server/private client pair. At that point, validating the certificate eliminates a host of other possible problems.

  3. While you could read a lot about security issues, like Crypto 101, the short version is use TLS (the new name for SSL) to transmit the data and GPG to store the data. TLS keeps others from seeing and altering the data when moving it. GPG keeps others from seeing and altering the data when storing or retreiving it. See also: How to safely keep a decrypted temporary data? Enough about security!

  4. SqlLite3, used with gpg, is fine until you get too large. After that, you can move to MariaDB (the supported version of MySQL), PostGreSQL, or something like Mongo. I'm a proponent of doing things that don't scale and getting something working now is worthwhile.

  5. For the GUI, you'll hate my answer: HTML/CSS/JavaScript. The odds that you will need a portal or mobile app or remote access or whatever are compelling. Use jQuery (or one of its lightweight cousins like Zepto). Then run your application as a full screen application without a browser bar or access to other sites. You can use libraries to emulate the native look and feel, but customers almost always go "oh, I know how to use that" and stop asking.

  6. Still hate the GUI answer? While you could use Tcl/Tk or Wx but you will forever be fighting platform bugs. For example, OS/X (Mac) users need to install ActiveState's Tcl/Tk instead of the default one. You will end up with a heavy solution for the images (PIL or ImageMagick) instead of just the HTML image tag. There is a huge list of other GUIs to play with, including some using the new 'yield from' construct. Still, you do better with HTML/CSS/JavaScript for now. Watch the "JavaScript: the Good Parts" and then adopt an attitude of ship it as it works.

  7. Push hard to use either Python 2,7 or Python 3.3+. You don't want to be fighting the rising tide of better support when you making a complicated application.

I do this stuff for FUN!


GUI library

First of all, please leverage the work people have done to compile this GuiProgramming list.

One one the packages that stood out to me was Kivy. You should definitely check it out (at least the videos / intro). The Kivy project has some nice introduction. I have to say I haven't followed it in full but it looks very promising. As for your requirements to be cross-platforms you can do that.

Packaging

There is an extensive documentation on how to package your app for the different platforms. For MacOSX and Windows it uses PyInstaller, but there are instructions for Android and iOS.

Client-side database

Yes, sqlite3 is the way to go. You can use sqlite3 with Kivy. You can also use SQLAlchemy if you need to connect to your sqlite database or if you need to connect to a remote one.

Retrieving content

The requests library is awesome to do http requests and IMHO is much simpler to use than a combination of httplib, urllib2.


Both PySide and WxPython support all five of your requirements. WxPython uses actual native widgets and also has custom extensions and widgets built on top. It has goodies like wx.CallAfter which'll allow you to run your background tasks in a separate thread and hop back on the UI thread easily.

PySide has a nicer API but draws its own widgets that imitate the underlying OS's UI. It's not as mature as WxPython and packaging it with tools like cx_freeze and PyInstaller is slightly more involved.

Also I recommend that you use an ORM like peewee over plain Sqlite3 for the data storage, it makes managing the data a lot easier and plays well with the freezing tools.