4

I have coded a few 100 Kloc of Python, but have never yet added a GUI. Can you recommend me a GUI framework? (I am looking at you, @SteveBarnes ;-)

Must be:

  • cross platform: Windows, Linux, Android, iOs & Mac
  • plays well with Leaflet mapping

Nice to have:

  • runs in the browser too
  • free for commercial use, but I am happy with one which is free until I make $ X with it, rather than free but with fewer features, and I have to pay for some features before I begin to earn from it (which I will almost certainly never do)
  • good documentation, forums, code samples, tutorials, Udemy, etc
  • drag & drop GUI designer

Bonus features:

  • MVC (Model, View, Controller)
  • two way data binding
1

My personal preference is wxPython but you might also like to take a look at Kivy but I am less familiar with the latter. A lot of people go with one of the bindings the QT framework but if you are planning on commercial use I would say avoid it like the plague as the licencing for the core library which you need even if the bindings are open source are a nightmare with high, annual, per dev seat, licenses required if you are looking at any commercial applications.

To take the points one at a time:

Must be:

  • cross platform:
    • Windows wxPython & Kivy = Yes
    • Linux wxPython & Kivy = Yes
    • Android Kivy = Yes, wxPython No
    • iOs Kivy = Yes, wxPython No at least at the moment
    • Mac wxPython & Kivy = Yes
  • plays well with Leaflet mapping: wxPython = Yes, Kivy = Maybe

Nice to have

  • runs in the browser too - As far as I know neither currently runs in browser.
  • free for commercial use - wxPython & Kivy = Yes
  • good documentation, forums, code samples, tutorials, Udemy, etc - wxPython Yes, Kivy Somewhat less so in my opinion,
  • drag & drop GUI designer - for wxPython there is wxGlade, wxFormBuilder and a few others, I am not sure what there is for Kivy.

Other considerations:

  • wxPython - mature, lots of support, books, etc. Native look & feel on each platform, also provides wrappers for a number of utility classes
  • Kivy - Modern, new, kivy look & feel

I would encourage people to use virtual environments to test the demos for each out to see which you like & meets your needs.

Another thing that you might wish to look at is Gooey - if your existing code is argparse based and you opt for wxPython then Gooey can give you an initial GUI by adding just 2 lines of code (one being the import)!

Instructions for installing each including the demos

  • Kivy has instructions here
  • For wxPython python -mpip install wxPython will also install wxDemo and wxDocs utilities to download (if needed), unpack (if needed) and run the demo or show the docs.

Some screenshots

wxDemo

Opening Screen enter image description here wx.Slider enter image description here TextCtrl enter image description here

Kivy Showcase

Opening Screen enter image description here Sliders enter image description here TextInputs enter image description here

Disclaimer

Please note that the above is my opinion and I may be slightly biased to wxPython rather than Kivy as I have been using the former for years and I have had a couple of minor code contributions accepted.

2
  • 1
    Wow! And he is back - with a vengeance! It will, obviously, take me a while to read though this, but thank you very much. I am sure that it will be of great help to everyone who reads this question in future. Mar 31 at 13:55
  • Not to question your thorough answer, but by the OPs requirements, wxPython is not acceptable due to not supporting iOS and Android.
    – Eric S
    Mar 31 at 19:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.