Skip to main content

VNC Qt Widget for Python using PyQt6

Project description

pyQVNCWidget

VNC Widget for Python using PyQt6

This is a fork of zocker-160/pyQVNCWidget, which updates the package to use PyQt6 instead of PyQt5.

How to install

pip3 install qvncwidget6

TODO from pyQVNCWidget

  • Proper error handling onFatalError
  • support for more than just RAW and RGB32 PIXEL_FORMATs
  • support for compression
  • implement rfb 3.7 and 3.8
  • implement local and remote clipboard

Examples (see /examples folder)

import sys
from PyQt6.QtWidgets import QApplication, QMainWindow
from qvncwidget6 import QVNCWidget

class Window(QMainWindow):
    def __init__(self):
        super().__init__()

        self.setWindowTitle("QVNCWidget")

        self.vnc = QVNCWidget(
            parent=self,
            host="127.0.0.1", port=5900,
            password="1234",
            readOnly=True
        )

        self.setCentralWidget(self.vnc)

        # if you want to resize the window to the resolution of the 
        # VNC remote device screen, you can do this
        self.vnc.onInitialResize.connect(self.resize)

        self.vnc.start()

    def closeEvent(self, ev):
        self.vnc.stop()
        return super().closeEvent(ev)

app = QApplication(sys.argv)
window = Window()
window.resize(800, 600)
window.show()

sys.exit(app.exec())

Example with widget input events

import sys
from PyQt6.QtWidgets import QApplication, QMainWindow
from qvncwidget6 import QVNCWidget

class Window(QMainWindow):
    def __init__(self):
        super().__init__()

        self.setWindowTitle("QVNCWidget")

        self.vnc = QVNCWidget(
            parent=self,
            host="127.0.0.1", port=5900,
            password="1234",
            readOnly=False
        )

        self.setCentralWidget(self.vnc)
        # we need to request focus otherwise we will not get keyboard input events
        self.vnc.setFocus()

        # you can disable mouse tracking if desired
        self.vnc.setMouseTracking(False)

        self.vnc.start()

    def closeEvent(self, ev):
        self.vnc.stop()
        return super().closeEvent(ev)

app = QApplication(sys.argv)
window = Window()
window.resize(800, 600)
window.show()

sys.exit(app.exec())

Example with window input events

In this example we are passing input events from the window to the widget

import sys
from PyQt6.QtWidgets import QApplication, QMainWindow
from qvncwidget6 import QVNCWidget

class Window(QMainWindow):
    def __init__(self):
        super().__init__()

        self.setWindowTitle("QVNCWidget")

        self.vnc = QVNCWidget(
            parent=self,
            host="127.0.0.1", port=5900,
            password="1234",
            readOnly=False
        )

        self.setCentralWidget(self.vnc)

        # you can disable mouse tracking if desired
        self.vnc.setMouseTracking(False)

        self.vnc.start()

    def keyPressEvent(self, ev):
        self.vnc.keyPressEvent(ev)
        return super().keyPressEvent(ev) # in case you need the signal somewhere else in the window

    def keyReleaseEvent(self, ev):
        self.vnc.keyReleaseEvent(ev)
        return super().keyReleaseEvent(ev) # in case you need the signal somewhere else in the window

    def closeEvent(self, ev):
        self.vnc.stop()
        return super().closeEvent(ev)

app = QApplication(sys.argv)
window = Window()
window.resize(800, 600)
window.show()

sys.exit(app.exec())

References

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

qvncwidget6-1.0.5.tar.gz (24.9 kB view details)

Uploaded Source

Built Distribution

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

qvncwidget6-1.0.5-py3-none-any.whl (27.3 kB view details)

Uploaded Python 3

File details

Details for the file qvncwidget6-1.0.5.tar.gz.

File metadata

  • Download URL: qvncwidget6-1.0.5.tar.gz
  • Upload date:
  • Size: 24.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.3.2 CPython/3.14.3 Windows/11

File hashes

Hashes for qvncwidget6-1.0.5.tar.gz
Algorithm Hash digest
SHA256 dc47cd97089d9618d2e48917d6847fc888b729205d30fa2f90a1ed7d18d64d79
MD5 24e4ba101aee995b9a2cd73f583c0847
BLAKE2b-256 0e32bdbca9ab5e0f4d11512708aecc5ce91b2a116ba24f11dc79c9248543c6be

See more details on using hashes here.

File details

Details for the file qvncwidget6-1.0.5-py3-none-any.whl.

File metadata

  • Download URL: qvncwidget6-1.0.5-py3-none-any.whl
  • Upload date:
  • Size: 27.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.3.2 CPython/3.14.3 Windows/11

File hashes

Hashes for qvncwidget6-1.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 3226cc7127241d611673a490bd0e7ce9acdd908d9eff7393f9451247aa3f8051
MD5 ab63127eef2d9c44d5bd0cc8e317ffb3
BLAKE2b-256 647e4ebe2be6ca9ead610df5f407634fb0f008f16199d57e52b2e9b94333c386

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