Skip to main content

Live coding for Python, Qt and QML

Project description

Live Coding Environment for Python, Qt and QML

PyPI version Build Status License: MIT Code style: black

Logo

This project provides a live coding environment for Python and Qt. It supportsQt for Python (PySide6).

If you need support Qt5 take a look python-qt-live-coding.

See also:

Install

To install the live coding environment run:

python setup.py install

or install it via pip

pip install pyside6-live-coding

You also need to install PySide6 for this application to work. The quickest way to achieve this is to use pip.

pip install PySide6

Use

The live coding environment comes with a live runner which enables your to live code Qt GUIs quickly.

Run following to test drive the example:

pyside6-live-coding examples

Your will instantly see the example project in the live runner.

Live Runner Example

Now you can either select the MainScreen.qml file or type MainScreen in the filter.

When you type, the file will be automatically selected.

When loaded you will see following.

Live Runner Example

This is the example GUI inside the live runner.

Now press the Edit button. Your favorite text editor should open promptly.

Edit the code inside the editor und you will see the GUI updates instantly when you save the document.

Integrate in your application

Alternatively, you can integrate live coding into your Python Qt application.

This especially useful if you want to customize the live coding GUI for your needs.

For this purpose you need to do following things:

  1. Integrate the start_live_coding function into your main.py.
  2. Add a command line argument for live coding.
  3. Optionally, add a custom live.qml.

To learn more about how this works please take a look the integrated example.

Python QML module support

The live coding environment has built in support for Python QML modules.

The idea is to place QML and Python code in the same directory, similar to how you would create a Qt/C++ application. Additionally, with Python we have the advantage of being able to discover modules automatically.

For this purpose add register_qml_types function to the __init__.py of your Python QML module. See the example in examples/standalone/module/__init__.py.

However, so far automatic reloading of Python code is not support. When you work on a Python module please use the Restart button which restarts the live coding application instead.

PyCharm Support

For this application to work with PyCharm and other IntelliJ IDEs please disable the "safe write" feature. The feature writes a temporary file before saving any file, which can confuse the file change watcher.

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

pyside6-live-coding-1.0.1.tar.gz (19.4 kB view details)

Uploaded Source

File details

Details for the file pyside6-live-coding-1.0.1.tar.gz.

File metadata

  • Download URL: pyside6-live-coding-1.0.1.tar.gz
  • Upload date:
  • Size: 19.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.10

File hashes

Hashes for pyside6-live-coding-1.0.1.tar.gz
Algorithm Hash digest
SHA256 2e760ce45e7387c1662b2036ac9d0fed3561d67ae75dd0c8cb8225a4b47fbb3b
MD5 105be311cfe949a0da3de3691d88cf30
BLAKE2b-256 2c8bd2581429da33ae20d5946e30f75145f9d5ab70a8f3548af2056188af933a

See more details on using hashes here.

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