Skip to main content

Light weight python interpreter, easy to embed into Qt applications

Project description

pyqtconsole is a light weight python console for Qt applications. Its made to be easy to embed in other Qt applications and comes with some examples that shows how this can be done. The interpreter can run in a separate thread, in the UI main thread or in a gevent task. There is also support for asyncio using trollius, however this is still in the experimental stage.

Installing

Simply type:

python setup.py install

or:

pip install pyqtconsole

Simple usage

See the examples directory for more examples:

import sys
from threading import Thread
from PyQt5.QtWidgets import QApplication

from pyqtconsole.console import PythonConsole

app = QApplication([])
console = PythonConsole()
console.show()
console.eval_in_thread()

sys.exit(app.exec_())

Embedding

  • Separate thread - Runs the interpreter in a separate thread, see the example threaded.py. Running the interpreter in a separate thread obviously limits the interaction with the Qt application. The parts of Qt that needs to be called from the main thread will not work properly, but is excellent way for having a ‘plain’ python console in your Qt app.

  • main thread - Runs the interpreter in the main thread, see the example inuithread.py. Makes full interaction with Qt possible, lenghty operations will of course freeze the UI (as any lenghty operation that is called from the main thread). This is a great alternative for people who does not want to use the gevent based approach but still wants full interactivity with Qt.

  • gevent - Runs the interpreter in a gevent task, see the example _gevent.py. Allows for full interactivity with Qt without special consideration (at least to some extent) for longer running processes. The best method if you want to use pyQtgraph, Matplotlib, PyMca or similar.

  • trollius (asyncio) - Runs the interpreter in a asyncio coroutine _trollius.py. Still experimental

Credits

The .qt sub module was taken from the pyQode. And provides Qt4 and Qt5 compatibility, the console is tested under both Qt4 and Qt5. The .qt sub module is included for easy distribution and to provide working examples for both versions 4 and 5 of Qt.

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

pyqtconsole-1.1.1.tar.gz (17.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyqtconsole-1.1.1-py2-none-any.whl (22.6 kB view details)

Uploaded Python 2

File details

Details for the file pyqtconsole-1.1.1.tar.gz.

File metadata

  • Download URL: pyqtconsole-1.1.1.tar.gz
  • Upload date:
  • Size: 17.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.18.4 setuptools/36.2.7 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/2.7.12

File hashes

Hashes for pyqtconsole-1.1.1.tar.gz
Algorithm Hash digest
SHA256 b658819a2fbac1d8a2f0ddcb917a226a3661f6c297284e4ed46a01df986fab7f
MD5 73cd3f7255a82380a008f4de85ce71c3
BLAKE2b-256 ee7de8e61e0f796404c00ec3da5dd49383343dbc8920af73ce800d4a5db8eb82

See more details on using hashes here.

File details

Details for the file pyqtconsole-1.1.1-py2-none-any.whl.

File metadata

  • Download URL: pyqtconsole-1.1.1-py2-none-any.whl
  • Upload date:
  • Size: 22.6 kB
  • Tags: Python 2
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.18.4 setuptools/36.2.7 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/2.7.12

File hashes

Hashes for pyqtconsole-1.1.1-py2-none-any.whl
Algorithm Hash digest
SHA256 58b8900bb7a5d0c9ec9efc45cc8a445fc335dbe8ee32197367da935c2fa1dabd
MD5 9affc1aa61bf37870a9a5f28896f4392
BLAKE2b-256 d53aead180f9098890290a7baa7a17c465552504d0dbf176fe32406c550c5cdc

See more details on using hashes here.

Supported by

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