@@ -0,0 +1,1796 @@
+#!/usr/bin/env python%0D%0A# -*- coding: utf-8 -*-%0D%0Aimport sys%0D%0Asys.path.insert(0, %22..%22)  # hack%0D%0Aimport sys%0D%0Afrom functools import partial%0D%0A%0D%0Afrom PyQt4 import QtGui%0D%0Afrom async_gui.engine import Task%0D%0Afrom async_gui.toolkits.pyqt import PyQtEngine%0D%0A%0D%0Aif sys.version_info%5B0%5D == 3:%0D%0A    from urllib.request import urlopen%0D%0Aelse:%0D%0A    from urllib import urlopen%0D%0A%0D%0A%0D%0Aengine = PyQtEngine()%0D%0A%0D%0A%0D%0Aclass MainWidget(QtGui.QWidget):%0D%0A%0D%0A    def __init__(self, parent=None):%0D%0A        super(MainWidget, self).__init__(parent)%0D%0A        button = QtGui.QPushButton(%0D%0A            %22Load image%22,%0D%0A            clicked=partial(self.do_work,%0D%0A                            %22http://www.google.com/images/srpr/logo4w.png%22),%0D%0A        )%0D%0A        self.status_label = QtGui.QLabel()%0D%0A        self.image_label = QtGui.QLabel()%0D%0A        layout = QtGui.QVBoxLayout(self)%0D%0A        layout.addWidget(button)%0D%0A        layout.addWidget(self.status_label)%0D%0A        layout.addWidget(self.image_label)%0D%0A%0D%0A    @engine.async%0D%0A    def do_work(self, url, *args):%0D%0A        self.status_label.setText(%22Downloading...%22)%0D%0A        data = yield Task(self.load_url, url)%0D%0A        self.status_label.setText(%22Done...%22)%0D%0A        pixmap = QtGui.QPixmap.fromImage(QtGui.QImage.fromData(data))%0D%0A        self.image_label.setPixmap(pixmap)%0D%0A%0D%0A    @engine.async%0D%0A    def on_button_click(self):%0D%0A        urls = %5B'http://www.google.com',%0D%0A                'http://www.yandex.ru',%0D%0A                'http://www.python.org'%5D%0D%0A        result = yield %5BTask(self.load_url, url) for url in urls%5D%0D%0A%0D%0A    def load_url(self, url):%0D%0A        return urlopen(url).read()%0D%0A%0D%0A%0D%0Aif __name__ == %22__main__%22:%0D%0A    app = QtGui.QApplication(sys.argv)%0D%0A    engine.set_main_app(app)%0D%0A    window = MainWidget()%0D%0A    window.resize(640, 480)%0D%0A    window.show()%0D%0A    sys.exit(app.exec_())%0D%0A

add simplified Qt example