User Tools

Site Tools


misc:gui_frameworks_for_linux

GUI frameworks for Linux

Python-centric

Tkinter

TL;DR: Perhaps OK for small, one-file utility apps

Pros

  • Comes out of the box with Python.

Cons

  • Look and feel are a real buzzkill on Linux, possibly also on other platforms—even with themed widgets. The ugliness of menus is pretty much a deal killer
  • No standard GUI builder, though a few 3rd party ones exist.
tkdemo.py
from tkinter import *
from tkinter import ttk
 
def do_nothing():
    print('passssss ...')
 
root = Tk()
root.option_add('*tearOff', False)
s=ttk.Style()
s.theme_use('clam')
 
# Menubar
menubar = Menu(root)
root.config(menu=menubar)
 
filemenu = Menu(menubar)
filemenu.add_command(label='New ...', accelerator='Ctrl + N', command=do_nothing)
filemenu.add_command(label='Open ...', accelerator='Ctrl + O', command=do_nothing)
filemenu.add_separator()
filemenu.add_command(label='Quit', accelerator='Ctrl + Q', command=root.destroy)
 
editmenu = Menu(menubar)
editmenu.add_command(label='Copy', accelerator='Ctrl + C', command=do_nothing)
editmenu.add_command(label='Cut', accelerator='Ctrl + X', command=do_nothing)
editmenu.add_command(label='Paste', accelerator='Ctrl + V', command=do_nothing)
 
menubar.add_cascade(label='File', menu=filemenu)
menubar.add_cascade(label='Edit', menu=editmenu)
 
# Toolbar
toolbar = ttk.Frame(root)
 
tb_foo = ttk.Button(toolbar, text='Foo', command=do_nothing)
tb_foo.pack(side=LEFT, padx=2, pady=2)
tb_bar = ttk.Button(toolbar, text='Bar', command=do_nothing)
tb_bar.pack(side=LEFT, padx=2, pady=2)
 
toolbar.pack(side=TOP, fill=X)
 
# Status bar
status = ttk.Label(root, text='System status: doing nothing', borderwidth=2, relief=SUNKEN, anchor=W)
status.pack(side=BOTTOM, fill=X)
 
# Go!
root.mainloop()

PyGObject

TL;DR: Perhaps best option for Linux-centric apps—unless/until some GNOME goofiness happens.

Replacing PyGTK.

Pros

  • Workflow (UI layout to code) is pleasant.
  • First-class Linux framework.
  • LGPL
  • Nice support for externally defined UIs.
  • Nice UI builder.
  • Potentially tons of GNOME stuff to leverage.
  • Code seems grainy but otherwise understandable.
  • Easy to install if using distro packages.

Neutral/undecided

  • Event handling is simple event→callback; no “listener” or signal/slot concepts.
  • Event names are specified as strings.

Cons

  • Poor support on other operating systems.
  • GTK3 is the future and it is built for GNOME. For other desktop environments, who knows how well it will work and what will be supported. Will a ton of GNOME dependencies eventually be required?

wxPython (including Phoenix)

TL;DR: Perhaps best option for multi-platform proprietary apps that have zero budget.

Pros

  • Liberal license.
  • True multi-platform support (e.g., native icons, native order dialog buttons).
  • ? install (suspect easy if distro repos are used)

Cons

  • Support for Python 3 via Phoenix is still raw.
  • Second-class Linux framework.
  • Wonky UI builder support
    • Requires third-party tools:
      • wxFormBuilder needs to be built (generally not in repos), generates .fbp files, which are XML but not really human readable.
      • wxGlade is incomplete.
      • wxSmith is integrated with Code::Blocks.
    • No UI file format results in slightly awkward UI file export/import mechanism: export a class with UI builder, subclass it in the app to make your wired-up window.
  • Code seems awkward at times (perhaps it's only oddly named components)

Awkward points:

  • In wxville, a Frame is a window, a Window is the mega-parent class, a Control is a widget.
  • Method names are CamelCase (first capitalized).
  • Events: self.Bind(event-type, handler, emitting-object)

PyQt

TL;DR: Perhaps best option for multi-platform FOSS apps and for proprietary apps that have a $500 tools budget.

Pros

  • First class Linux framework.
  • Excellent multiplatform support (except maybe non-GNOME GTK).
  • Lots of components (including “we do it differently” DBUS, etc.)
  • Used by Spyder and a lot of others.

Cons:

  • GPL-only or commercial license is at ~$500. (PySide is LGPL, but there has been little development.)
  • Qt code can be heavy, somewhat verbose.
  • Possibly PITA to install if not using distro repos (which you want because it moves so fast).1)

PySide

TL;DR: Abandonware? If not now, later?

Classic PySide was released in 2015 and works with Qt 4.8 framework. PySide2, which supports Qt5, is being developed, but it's not production ready, seems to be moving slowly, and doesn't seem to have much mindshare.

Kivy

TL;DR: Not really a desktop application framework. Well-suited to touch interfaces.

Pros

  • MIT license.

libavg

Needs research

Pros

  • LGPL

PyGui

Is a wrapper around desktop toolkits. On Linux, wraps PyGTK right now, PyGObject in the future.

1)
on Debian, qttools5-dev-tools will get standalone Qt Designer and other stuff.
misc/gui_frameworks_for_linux.txt · Last modified: 2017/05/29 19:28 by mithat

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki