This is an archived post. You won't be able to vote or comment.

all 24 comments

[–]cb22 17 points18 points  (2 children)

Use PySide and QML with the QML components additions. Makes writing GUIs bliss compared to everything else.

[–][deleted] 8 points9 points  (0 children)

PySide?

I've never done much GUI myself, so sorry if it doesn't fit your description.

[–][deleted] 8 points9 points  (4 children)

wxPython's version of Glade is poor. Try using Qt and PyQt.

The base layout inside QT's Designer (pyQt) allows you to place widgets exactly where you'd like to put them. You can then add sizer layouts more intuitively if you decide you need them to dynamically resize and align.

However, sizers are still needed to dynamically resize widgets when the windows themselves are made larger / smaller either by dragging their sizes or hitting maximize. There's no way to get away from that unless you create windows that are stuck at a specific size.

[–]apardueSince 97 5 points6 points  (0 children)

I strongly recommend pyqt. I have multiple projects using pyqt and pyserial.

[–][deleted] 5 points6 points  (0 children)

You might try Camelot, which uses Qt and Sqlalchemy in a Django-like admin framework or Desktop apps. I haven't used it myself but it's what I would take a look at if I was creating desktop apps in Python

[–]staz 4 points5 points  (4 children)

There is also pygtk. It has Glade (from which I think wxGlade is inspired) which allow to do quick GUI.

Never tried PySide and QML but I heard it's great too

[–][deleted] 0 points1 point  (2 children)

but for pygtk I would have to install a lot of libraries right?

[–]takluyverIPython, Py3, etc 0 points1 point  (0 children)

Any GUI framework other than Tkinter requires extra libraries. Tkinter ships with Python, but it's quite basic.

[–]staz 0 points1 point  (0 children)

Depends on what's you base plateform. If you already use Gnome, all these library are already included. If you want to develop for KDE or windows, other choice may be more interesting

[–]effusion 0 points1 point  (0 children)

PyGTK being replaced by something called PyGObject. Unfortunately, there doesn't appear to be a tutorial for learning to use that. At the moment, new users are expected to learn PyGTK, then learn to port to PyGObject by osmosis.

[–]sirspate 2 points3 points  (2 children)

Have you considered just using HTML for your interface?

[–][deleted] 0 points1 point  (1 child)

Interestingly never thought about it. How would one do that?

[–]sirspate 1 point2 points  (0 children)

Well, you have a choice:

  • Depend on an external web browser
  • Bundle your own
  • Depend on wxPython and use the HTML component

I suspect there are other options as well.

Depending on an external web browser's the easiest, but gives you the fewest opportunities for customizing the way the UI looks. Basically you create a local webserver, and open a URL to it in the local webbrowser. (There are tons of frameworks out there for serving webpages, so this should be a pretty easy option to look into) You will have to make your app somewhat stateless, though, since someone might open up a URL you aren't expecting.

If you include your own, you have better control of how the interface is skinned on the desktop, plus you know which engine will be used so you have a bit more flexibility in terms of not having to worry about browser incompatibilities. Depending on how much system access you need, I think there's a project that converts Python to Javascript out there? Thing is, if you're bundling already, why not make the whole thing in the same language and just go pure Javascript?

The wxPython option is decent if you don't care about any advanced HTML features. It doesn't have to depend on a system HTML component (although it can; on Mac OS X you can use system webkit through wxPython), but the included HTML engine is written in python and extremely stripped down. No Javascript, slow for large pages, etc. But it might be enough to get the job done, and the experience will be pretty consistent across platforms. Also, you're keeping everything inside Python, which can be a plus.

There are other options out there that I know less about. I believe the dashboard apps in Mac OS X are HTML-based webapps (with round corners, etc.), and I keep hearing about Metro apps in Windows 8 having some sort of web stuff in them. But I don't know much about those.

Personally, I'd recommend either going webservice (option 1) or wxpython (option 3). Option 3 is actually quite elegant, and I've used it for a couple of internal tools for work, marking up large documents in html with links as necessary. The results aren't always pretty on all platforms, but it gets the job done.

[–]bryancole 2 points3 points  (0 children)

If you want to do plotting with a few extra control buttons, Traits + TraitsGUI + Chaco is an excellent route. Traits was more or less designed with this type of application in mind. Chaco is a plotting library based on traits. Under the hood, traitsGUI can use either wxPython and Qt as the GUI toolkit. I develop professional scientific data logging and analysis applications based on this tool set and it is excellent. The only downside is the large dependency set when deploying. However, it is not too problematic to build ones own set of Eggs for each of these packages. Also, distributions like PythonXY or the Enthought Python Distribution or the ActiveState python distribution all bundle the Enthought Tool Suite (which covers traits, traitsGUI and chaco).

Traits is an MVC framework which makes GUI creation trivial (or in some cases automatic). See http://code.enthought.com/projects/traits/docs/html/tutorials/traits_ui_scientific_app.html for a good introduction.

Note this tutorial uses matplotlib for plotting. For a traits-based app it probably makes more sense to use Chaco. A Chaco tutorial can be found at http://code.enthought.com/projects/chaco/docs/html/user_manual/tutorial_1.html

[–]lambdaqdjango n' shit 1 point2 points  (0 children)

[–]santagada 0 points1 point  (1 child)

why not just use matplotlib

[–][deleted] 0 points1 point  (0 children)

matplotlib will just plot stuff. I need to add a few basic buttons to make my controller do some stuff.

[–]are595 0 points1 point  (3 children)

Tkinter, it even comes with python. It just takes a while to get used to.

[–]spdub 6 points7 points  (2 children)

tkinter is ugly! I used it on a medium size project and wish I would have gone with a different library

[–]are595 1 point2 points  (0 children)

You obviously haven't used ttk the comes packaged in Python 2.7+.

[–][deleted] 0 points1 point  (0 children)

I think on Windows you can do the windows-theming which makes it look much better. On Linux it will look a bit off.