Skip to main content

Easy threading and multiprocessing for GUI applications

Project description


async_gui is a library aimed to make use of threads in GUI applications simpler. It’s inspired by PyCon talk Using futures for async GUI programming in Python 3.3 and tornado @gen.engine implementation.

Most of GUI toolkits don’t allow you to access graphical elements from non-GUI thread. Python 3.2+ has nice new feature concurrent.futures, but we can’t just wait for result from future and callbacks are not very handy.

Combination of Coroutines via Enhanced Generators (PEP-342) and futures creates a rich and easy to use asynchronous programming model which can be used for creating highly responsive GUI applications.


Demo of button click handler:

def on_button_click(self, *args):
    self.status_label.setText("Downloading image...")
    # Run single task in separate thread
    image_data = yield Task(self.load_url,
    pixmap = QtGui.QPixmap.fromImage(QtGui.QImage.fromData(image_data))
    self.status_label.setText("Downloading pages...")
    urls = ['',
    # Run multiple task simultaneously in thread pool
    pages = yield [Task(self.load_url, url) for url in urls]
    avg_size = sum(map(len, pages)) / len(pages)
    self.result_label.setText("Average page size: %s" % avg_size)

Tasks yielded from on_button_click() executed in thread pool, but GUI updates done in the GUI thread. For CPU-bound applications there is also ability to run tasks in pool of processes.

See full example in examples directory.


  • Python 2.7+ (futures required), Python 3+ support
  • PyQt4/PySide, Tk, Wx, Gtk GUI toolkits support. Easy to add another
  • Can execute tasks in Thread, Process, Greenlet (gevent required)
  • Possibility to run multiple tasks at the same time
  • Straightforward exception handling
  • Full test coverage


Using pip:

$ pip install async_gui

Or download, unpack and:

$ python install

To run tests use:

$ python test


0.2.0 (2013-0x-xx)

  • MultiTask can return generator of ready tasks instead waiting for all done

0.1.0 (2013-04-06)

  • initial PyPI release

Project details

Release history Release notifications

This version


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for uncrumpled_async_gui, version 0.1.1
Filename, size File type Python version Upload date Hashes
Filename, size uncrumpled_async_gui-0.1.1-py3-none-any.whl (12.9 kB) File type Wheel Python version 3.5 Upload date Hashes View hashes
Filename, size uncrumpled_async_gui-0.1.1.tar.gz (21.4 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page