Skip to main content

A Matplotlib backend for working with (Q)Threads and Qt

Project description

A Matplotlib backend for working with (Q)Threads and Qt

Features

A minimal example:

import threading
import time
import mpl_qtthread.backend
import matplotlib
import matplotlib.backends.backend_qt

mpl_qtthread.backend.initialize_qt_teleporter()
matplotlib.use("module://mpl_qtthread.backend_agg")

import matplotlib.pyplot as plt

plt.ion()


def background():
    # time.sleep(1)
    fig, ax = plt.subplots()
    (ln,) = ax.plot(range(5))
    for j in range(5):
        print(f"starting to block {j}")
        ln.set_color(f"C{j}")
        ax.set_title(f'cycle {j}')
        fig.canvas.draw_idle()
        time.sleep(5)


threading.Thread(target=background).start()
matplotlib.backends.backend_qt.qApp.exec()

Project details


Download files

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

Source Distribution

mpl-qtthread-0.0.1.tar.gz (17.2 kB view hashes)

Uploaded Source

Built Distribution

mpl_qtthread-0.0.1-py3-none-any.whl (6.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page