UI toolkits for Python

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Kenneth McDonald

    UI toolkits for Python

    Is there any emerging consensus on the "best" UI for toolkit. Tk
    never quite made it but from what I can see, both qt and wxWin are
    both doing fairly well in general. I'm already aware of the licensing
    issues surrounding qt (fwiw, I think their license fee for commercial
    use is eminently reasonable), so aside from that, I was wondering if
    there was any feedback readers could provide on the following:

    1) Which plays best with Python? Ideally, it would already have some
    higher-level python libraries to hide the grotty stuff that is almost
    never needed when actually implementing apps.

    2) Reliability of each?

    3) Useful external libraries for each?

    4) Ease of installation/use on OS X?

    Something with a genuinely useful text widget would be nice, but I
    know that's too much to expect...ah, TkText widget, where are you
    when I need you.


    Thanks,
    Ken
  • Paul Rubin

    #2
    Re: UI toolkits for Python

    Kenneth McDonald <kenneth.m.mcdo nald@sbcglobal. net> writes:[color=blue]
    > 1) Which plays best with Python? Ideally, it would already have some
    > higher-level python libraries to hide the grotty stuff that is almost
    > never needed when actually implementing apps.
    >
    > 2) Reliability of each?
    >
    > 3) Useful external libraries for each?
    >
    > 4) Ease of installation/use on OS X?[/color]

    The answer to each of those questions points to Tkinter. It comes
    with Python by default (the least installation hassles of any
    toolkit), is pretty reliable, has a reasonably Pythonic interface, and
    I don't understand the question about external libraries.

    However, Tkinter not most people's favorite, because the widgets look
    crude, they don't resemble the native widgets of any popular platform,
    and the widget set is somewhat limited.

    That suggests you're not asking the right questions.

    I use Tkinter because the Python gui's I've built so far have been for
    straightforward functionality purposes without being fancy. However,
    if I were doing something for wide distribution and wanted it to look
    sharp, at this point I think I'd go for PyGtk despite the preference
    of many for wxpython.

    Finally, don't overlook the possibility of embedding a basic web
    server in your app, and having the user communicate with it through a
    web browser. That turns HTML into your gui, which is very easy to
    program. It also lets you easily handle remote clients, multiple
    concurrent clients, etc, and gives users a familiar and intuitive
    interface.

    Comment

    • Kenneth McDonald

      #3
      Re: UI toolkits for Python

      Thanks for reminding me of Gtk. OK, add that to the list.

      The Web Browser interface is good for simple things, and will get better
      with CSS2's adoption, but they still don't have a good way for important
      things like interactive styled text, key bindings, etc. Good for
      simple things
      (for which I use them), not for more complex stuff.

      As for Tkinter, well, sigh, I have to go into a semi-rant, semi-
      eulogy right now.

      Tk was, IMHO, the hands-down award winner for UI toolkit farthest
      ahead of
      its time. I used it for years and years and years.

      Tcl, on the other had, wasn't the _worst_ scripting language of all
      time, but it
      was sure down in the bottom ten percent. How John Ousterhout could
      come up
      with Tk on one hand and the other at the same Tcl boggles my mind.

      Unfortunately, while Tkinter did provide in theory full access to Tk,
      it was in
      practice never finished. I wrote quite a bit of code to try to add a
      true pythonic
      interface to Tk via Tkinter (I'm happy to give it away if anyone
      wants--some of
      it is actually in pretty good shape). But it's a big job, and it
      became clear to me
      that Tk is going the way of the dinosaurs, so I abandoned it.

      Ddevelopment on the advanced features of Tk--what really made it worth
      using--has languished. Both marks and tags in the Text widget have been
      fundamentally broken forever (not buggy, I mean broken in the sense that
      their semantics destroys a great deal of their real potential), and I
      don't see
      they'll ever be fixed. Same thing with tags in the Canvas widget.
      Plus the
      lack of well-thought-out new widgets, and various other sins of omission
      and comission, and I decided that Tkinter was clearly in the last of
      its days.

      That said, if I was one of the founders of Google, Tk would be one of
      the
      projects I'd hire a lot of people to get on to and actually realize
      its potential.
      But I don't even buy lottery tickets :-)

      Now I'm just waiting until one of the other kits becomes mature enough
      (if ever) to start using it. So this is a query about that :-)
      On 13-Oct-05, at 3:21 PM, Paul Rubin wrote:
      [color=blue]
      > Kenneth McDonald <kenneth.m.mcdo nald@sbcglobal. net> writes:
      >[color=green]
      >> 1) Which plays best with Python? Ideally, it would already have some
      >> higher-level python libraries to hide the grotty stuff that is almost
      >> never needed when actually implementing apps.
      >>
      >> 2) Reliability of each?
      >>
      >> 3) Useful external libraries for each?
      >>
      >> 4) Ease of installation/use on OS X?
      >>[/color]
      >
      > The answer to each of those questions points to Tkinter. It comes
      > with Python by default (the least installation hassles of any
      > toolkit), is pretty reliable, has a reasonably Pythonic interface, and
      > I don't understand the question about external libraries.
      >
      > However, Tkinter not most people's favorite, because the widgets look
      > crude, they don't resemble the native widgets of any popular platform,
      > and the widget set is somewhat limited.
      >
      > That suggests you're not asking the right questions.
      >
      > I use Tkinter because the Python gui's I've built so far have been for
      > straightforward functionality purposes without being fancy. However,
      > if I were doing something for wide distribution and wanted it to look
      > sharp, at this point I think I'd go for PyGtk despite the preference
      > of many for wxpython.
      >
      > Finally, don't overlook the possibility of embedding a basic web
      > server in your app, and having the user communicate with it through a
      > web browser. That turns HTML into your gui, which is very easy to
      > program. It also lets you easily handle remote clients, multiple
      > concurrent clients, etc, and gives users a familiar and intuitive
      > interface.
      > --
      > http://mail.python.org/mailman/listinfo/python-list
      >[/color]

      Comment

      • Mark Roseman

        #4
        Re: UI toolkits for Python

        Paul Rubin <http://phr.cx@NOSPAM.i nvalid> wrote:[color=blue]
        > However, Tkinter not most people's favorite, because the widgets look
        > crude, they don't resemble the native widgets of any popular platform,
        > and the widget set is somewhat limited.[/color]


        People should probably be more aware of work that has been going on with
        Tk recently (after a fairly long hiatus) in terms of greatly improving
        its appearance, adding theming, and more. It's worth checking out, and
        of course, if there's a way to help get some of these changes into
        Tkinter, the Tk folks would I'm sure be helpful.

        Here's a portion of a note that Jeff Hobbs posted to the Ruby group
        recently, on a similar topic:

        [color=blue]
        > From: Jeff Hobbs <jeffh@removeth is.activestate. com>
        > Subject: Re: The definitive GUI for Ruby
        > Date: Wed, 05 Oct 2005 11:02:46 -0700
        > Newsgroups: comp.lang.ruby
        > Message-ID: <43441546.20403 07@removethis.a ctivestate.com>
        >
        > Eustaquio Rangel de Oliveira J wrote:[color=green]
        > > Tk is still too ugly for make programmers that are
        > > migrating. :-)[/color]
        >
        > Tk is only ugly if that's the way you like it. You have a
        > full set of themed widgets available now that give you
        > native look and feel, with all the same dynamic control and
        > general ease of use that Tk has always provided. All this
        > on Aqua, Win32 and X11 (even Windows/CE). Some screenshots
        > of Tk apps that try not to be ugly:
        >
        > The Perl Dev Kit and Tcl Dev Kit UIs:
        > http://aspn.activestate.com/ASPN/doc...ild_parameters
        > http://aspn.activestate.com/ASPN/doc...2/TclVFSE.html
        >
        > Tk on Win/CE (I know that the Perl/Tcl::Tk use this too):
        > http://wiki.tcl.tk/8442
        >
        > Coccinella:
        > http://hem.fyristorg.com/matben/
        > http://hem.fyristorg.com/matben/examples/index.html
        >
        > An installer builder:
        > http://installbase.sourceforge.net/screenshots.shtml
        >
        > An example of improving a Tk app by "going native":
        > http://wiki.tcl.tk/14522[/color]

        Comment

        • Grant Edwards

          #5
          Re: UI toolkits for Python

          On 2005-10-13, Paul Rubin <> wrote:
          [color=blue]
          > The answer to each of those questions points to Tkinter. It comes
          > with Python by default (the least installation hassles of any
          > toolkit), is pretty reliable, has a reasonably Pythonic interface, and
          > I don't understand the question about external libraries.
          >
          > However, Tkinter not most people's favorite, because the widgets look
          > crude, they don't resemble the native widgets of any popular platform,
          > and the widget set is somewhat limited.[/color]

          Aside from the look & feel issue with Tk, the other objection
          sometimes heard is that Tk is integrated into Python by
          including Tcl as well (as opposed to doing an actual Tk binding
          the way some other languages have done). It's an eminently
          practical approach, but it sure makes you feel dirty.

          --
          Grant Edwards grante Yow! Hey!! Let's watch
          at the' ELEVATOR go UP and
          visi.com DOWN at th' HILTON HOTEL!!

          Comment

          • gsteff

            #6
            Re: UI toolkits for Python

            I've used wxpython and pygtk, and have a strong preference for pygtk.
            wxpython has some advantages: it has better OSX support (widgets look
            native, and it doesn't require the installation of the Fink x server),
            and better win32 support (a few gtk widgets, such as menus, don't look
            quite native on gtk, and multithreading with pygtk on win32 is
            problematic). But pygtk has better documentation, a MUCH cleaner api,
            integration with the Glade GUI designer (wxpython has wxglade, but its
            not in the same league), and a richer widget set. In addition, top
            itself is in the top tier of free software projects; wxwidgets is not
            as mature, and its development is not as active.

            So, if you're trying to choose between those two, go with wxpython if
            you need OSX support, or have specific issues with pygtk's win32
            support. In all other cases, I'd reccomend pygtk.

            Greg

            Comment

            • gsteff

              #7
              Re: UI toolkits for Python

              Er, meant to say "In addition GTK itself is in the top tier of free
              software projects"

              Comment

              • Fredrik Lundh

                #8
                Re: UI toolkits for Python

                > > However, Tkinter not most people's favorite, because the widgets look[color=blue][color=green]
                > > crude, they don't resemble the native widgets of any popular platform,
                > > and the widget set is somewhat limited.[/color][/color]

                (given that the web interface is the new black, that's not much of
                an argument. tkinter with the right stylesheet can look anyway you
                want)

                Mark Roseman wrote:
                [color=blue]
                > People should probably be more aware of work that has been going on with
                > Tk recently (after a fairly long hiatus) in terms of greatly improving
                > its appearance, adding theming, and more. It's worth checking out, and
                > of course, if there's a way to help get some of these changes into
                > Tkinter, the Tk folks would I'm sure be helpful.[/color]

                maybe this should be reposted to tkinter-discuss ?

                fwiw, I still use Tkinter for all UI:s I build, but these days, 80-90%
                of the visible widgets are based on this module:



                sometimes combined with:



                </F>



                Comment

                • Ville Voipio

                  #9
                  Re: UI toolkits for Python

                  In article <mailman.2028.1 129234395.509.p ython-list@python.org >,
                  Kenneth McDonald wrote:
                  [color=blue]
                  > 4) Ease of installation/use on OS X?[/color]

                  There are two questions which may restrict your choice
                  rather a lot:

                  #1 Should the UI look the same on each platform or should it
                  look the same as all other apps on the platform?

                  #2 Are you trying to make a simple installation package which
                  includes everything needed?

                  With OS X compatibility you tend to come across with the
                  fact that many "OS X compatible" things are actually X11
                  things. X11 certainly looks different from Aqua (the native
                  interface). Also, X11 is not always installed, and some
                  unixish things require using Fink to install them. Not
                  something Joe A. User usually has on his Mac.

                  GTK is an example of this. There is an Aqua version of
                  GTK, but it seems to be rather outdated. The newer versions
                  run on X11 but installing them may be just laborious or
                  then plain pain depending on your luck. And you still need
                  the X11 installed.

                  So, if you are looking for something that looks like Mac
                  and works like Mac, do not touch anything with X11. OTOH,
                  if you just need to get something working on your own
                  OS X computer, then X11 is fine.

                  ---

                  I have tried using wxPython for Mac/Windows cross-platform
                  GUIs. This far it seems to work fine, but I have not tried
                  anything very fancy. Mac applications have the OS X looks,
                  and Windows applications look Windowsish. Without having
                  a single line of platform-dependent code.

                  Making simple installation files (exe for Windows and dmg
                  for OS X) seems to work, as well. So, the installation should
                  be easy for the user.

                  - Ville

                  --
                  Ville Voipio, Dr.Tech., M.Sc. (EE)

                  Comment

                  • dberlin@gmail.com

                    #10
                    Re: UI toolkits for Python

                    I find wxPython to pro fill my GUI needs from python in a pretty good
                    way.
                    To show off it's capabilities - I am building a GUI editor and it
                    currently converts from windows forms (visual studio c# forms) to
                    wxPython code.
                    When I started programming this editor I thought I'd have major
                    incompatibility problems, thinking wxPython is extremely weaker than
                    the windows forms.
                    However, coding the conversion between the two proved wxPython to be
                    highly capable.
                    BTW, this GUI editor can be found here:


                    I believe this also provides an answer to gsteff's post about not
                    having a normal GUI editor.

                    Comment

                    • Claudio Grondi

                      #11
                      Re: UI toolkits for Python


                      "Kenneth McDonald" <kenneth.m.mcdo nald@sbcglobal. net> wrote in
                      news:mailman.20 32.1129236372.5 09.python-list@python.org ...[color=blue]
                      > Thanks for reminding me of Gtk. OK, add that to the list.
                      >
                      > The Web Browser interface is good for simple things, and will get better
                      > with CSS2's adoption, but they still don't have a good way for important
                      > things like interactive styled text, key bindings, etc. Good for
                      > simple things
                      > (for which I use them), not for more complex stuff.[/color]

                      I don't fully understand your attitude here. The Web Browser interface has
                      all I can imagine is required for a GUI, so what is missing when you
                      consider, that you can generate custom images on the fly on the server and
                      let the user shape the page without requesting CPU power from the server
                      using JavaScript.
                      I don't even name here the not really beeing itegral part of Internet
                      Browsers JavaApplets and any other kind of plugin stuff.
                      The only issue I can see with this approach is the speed of responding to
                      user interactions, but for really optimize this one needs a compiled
                      language anyway.
                      What is that complex, that it can't be solved using an Internet Browser as a
                      GUI?
                      Do I miss here something?

                      Claudio



                      Comment

                      • Malte Clasen

                        #12
                        Re: UI toolkits for Python

                        Claudio Grondi wrote:[color=blue]
                        > What is that complex, that it can't be solved using an Internet Browser as a
                        > GUI?[/color]

                        Nothing, but session management isn't trivial with http interfaces. You
                        have to deal with the back button of the browsers, bookmarks to pages
                        that result from posted forms, users leaving the application without
                        notice, etc.. And if you want to implement dialogs like the Photoshop
                        image resizing with automatic calculation of some widget data based on
                        other widgets (e.g. interlocked width and height), you have to rely on
                        JavaScript which isn't as platform independent as it should be and
                        sometimes deactivated due to security issues.

                        But if that doesn't bother you, you might want to have a look at
                        http://qooxdoo.sourceforge.net/ , "an advanced open-source javascript
                        based toolkit."

                        Malte

                        Comment

                        • Stefan Behnel

                          #13
                          Re: UI toolkits for Python

                          Kenneth McDonald schrieb:[color=blue]
                          > Is there any emerging consensus on the "best" UI for toolkit. Tk never
                          > quite made it but from what I can see, both qt and wxWin are both doing
                          > fairly well in general. I'm already aware of the licensing issues
                          > surrounding qt (fwiw, I think their license fee for commercial use is
                          > eminently reasonable), so aside from that, I was wondering if there was
                          > any feedback readers could provide on the following:[/color]
                          [snip]

                          As for my experience with Python-integrated GUI toolkits: I tried
                          wxWidgets/Boa and had it crashing on me all over the place. I switched to
                          GTK/glade2 and fought with it for a couple of days until I ran away screaming.
                          Next, I tried Qt/Designer and the more I learned, the more I knew I'd keep
                          loving it. Its Python bindings are not perfect, especially QStrings will annoy
                          you. You will notice that it was originally designed for C++ and had to try
                          hard to reimplement a lot of the batteries that Python has included, so it
                          often uses its own concepts where Python concepts would feel a bit nicer. But
                          once you accept that, you will really like its clean design that helps you
                          with your work.

                          A friend of mine switched to Mac-OS X recently and I told him to use Qt for
                          one of his projects. He is a Debian developer and did all of his previous GUIs
                          with GTK. It took him only a couple of hours to fall in love with it. He was
                          especially mad about the fact that it looks completely like a Mac application
                          on Mac-OS and like a Windows application on Windows. It even felt like a
                          native app.

                          Just try it, you'll see.

                          Stefan

                          Comment

                          • Stefan Behnel

                            #14
                            Re: UI toolkits for Python

                            Kenneth McDonald wrote:[color=blue]
                            > Is there any emerging consensus on the "best" UI for toolkit. Tk never
                            > quite made it but from what I can see, both qt and wxWin are both doing
                            > fairly well in general. I'm already aware of the licensing issues
                            > surrounding qt (fwiw, I think their license fee for commercial use is
                            > eminently reasonable), so aside from that, I was wondering if there was
                            > any feedback readers could provide on the following[/color]

                            Oh, one more thing with respect to web apps: There was the nufox announcement
                            recently, which seems to support XUL driven interfaces in Python.



                            Stefan

                            Comment

                            • Steve Holden

                              #15
                              Re: UI toolkits for Python

                              Claudio Grondi wrote:[color=blue]
                              > "Kenneth McDonald" <kenneth.m.mcdo nald@sbcglobal. net> wrote in
                              > news:mailman.20 32.1129236372.5 09.python-list@python.org ...
                              >[color=green]
                              >>Thanks for reminding me of Gtk. OK, add that to the list.
                              >>
                              >>The Web Browser interface is good for simple things, and will get better
                              >>with CSS2's adoption, but they still don't have a good way for important
                              >>things like interactive styled text, key bindings, etc. Good for
                              >>simple things
                              >>(for which I use them), not for more complex stuff.[/color]
                              >
                              >
                              > I don't fully understand your attitude here. The Web Browser interface has
                              > all I can imagine is required for a GUI, so what is missing when you
                              > consider, that you can generate custom images on the fly on the server and
                              > let the user shape the page without requesting CPU power from the server
                              > using JavaScript.[/color]

                              In this case then, I'm afraid the failure is in your imagination :-)
                              [color=blue]
                              > I don't even name here the not really beeing itegral part of Internet
                              > Browsers JavaApplets and any other kind of plugin stuff.
                              > The only issue I can see with this approach is the speed of responding to
                              > user interactions, but for really optimize this one needs a compiled
                              > language anyway.
                              > What is that complex, that it can't be solved using an Internet Browser as a
                              > GUI?
                              > Do I miss here something?
                              >[/color]
                              While you are correct in saying (I paraphrase) that HTML interfaces
                              nowadays can offer a rich graphical interface, it can be quite difficult
                              to manage state maintenance between the two components (web server, web
                              client) in the system.

                              A "proper" GUI runs all functionality inside a single process, and
                              allows much easier control over complex interactions, creation of
                              dynamic dialogues, and so on.

                              regards
                              Steve
                              --
                              Steve Holden +44 150 684 7255 +1 800 494 3119
                              Holden Web LLC www.holdenweb.com
                              PyCon TX 2006 www.python.org/pycon/

                              Comment

                              Working...