Qt Demo

This will launch various Qt compatible packages

Nota: as of 2018-04-29th, PySide2-5.11 compatibility is

  • Ok for Qtconsole, Qtpy, pyzo, wppm
  • ToDo for PyQtgraph, Spyder, guidata, guiqwt, rx

Qt4 & Qt5 Dedicated Graphic libraries: PyQtgraph, guidata, guiqwt

In [ ]:
# PyQtgraph (Scientific Graphics and GUI Library for Python)
import pyqtgraph.examples; pyqtgraph.examples.run()
In [ ]:
# Guidata (Python library generating graphical user interfaces for easy dataset editing and display)
from guidata import tests; tests.run()
In [ ]:
# Guiqwt (Efficient 2D plotting Python library based on PythonQwt)
from guiqwt import tests; tests.run()
In [ ]:
#QtDemo (if present)
!if exist "%WINPYDIR%\Lib\site-packages\PyQt5\examples\qtdemo\qtdemo.py"  "%WINPYDIR%\python.exe" "%WINPYDIR%\Lib\site-packages\PyQt5\examples\qtdemo\qtdemo.py"
!if exist "%WINPYDIR%\Lib\site-packages\PyQt4\examples\demos\qtdemo\qtdemo.pyw""%WINPYDIR%\pythonw.exe" "%WINPYDIR%\Lib\site-packages\PyQt4\examples\demos\qtdemo\qtdemo.pyw"
!if exist "%WINPYDIR%\Lib\site-packages\PySide2\examples\datavisualization" "%WINPYDIR%\python.exe" "%WINPYDIR%\Lib\site-packages\PySide2\examples\datavisualization\bars3d.py"

Reactive programing: rx

In [ ]:
# from https://github.com/ReactiveX/RxPY/blob/master/examples/timeflie
from rx.subjects import Subject
from rx.concurrency import QtScheduler
import sys

try:
    from PyQt4 import QtCore
    from PyQt4.QtGui import QWidget, QLabel
    from PyQt4.QtGui import QApplication
except ImportError:
    try:
        from PyQt5 import QtCore
        from PyQt5.QtWidgets import QApplication, QWidget, QLabel
    except ImportError:
        from PySide import QtCore
        from PySide.QtGui import QWidget, QLabel
        from PySide.QtGui import QApplication


class Window(QWidget):

    def __init__(self):
        super(QWidget, self).__init__()
        self.setWindowTitle("Rx for Python rocks")
        self.resize(600, 600)
        self.setMouseTracking(True)

        # This Subject is used to transmit mouse moves to labels
        self.mousemove = Subject()

    def mouseMoveEvent(self, event):
        self.mousemove.on_next((event.x(), event.y()))


def main():
    app = QApplication(sys.argv)
    scheduler = QtScheduler(QtCore)

    window = Window()
    window.show()

    text = 'TIME FLIES LIKE AN ARROW'
    labels = [QLabel(char, window) for char in text]

    def handle_label(i, label):

        def on_next(pos):
            x, y = pos
            label.move(x + i*12 + 15, y)
            label.show()

        window.mousemove.delay(i*100, scheduler=scheduler).subscribe(on_next)

    for i, label in enumerate(labels):
        handle_label(i, label)

    sys.exit(app.exec_())

if __name__ == '__main__':
    main()
In [ ]:
!pip download --dest  C:\WinP\a QtPy