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-0.1.3.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-0.1.3-py3-none-any.whl (27.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: qvncwidget6-0.1.3.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-0.1.3.tar.gz
Algorithm Hash digest
SHA256 e88035c08fbc9623dcae10c67f395258dff36d171b0eac7adca358e74ea2e0da
MD5 a660f27a4bc3759869e16c92597bf1d3
BLAKE2b-256 0127475f94d70690f3f20fd4c121adc4be485d2ce5270d553217a8d4907c8c1c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: qvncwidget6-0.1.3-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-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 d7387d5ac9ec320f8adfffd5e5bd9b4d1d18b6760d8c2701a283d3aa03031a3c
MD5 8cf0a53791a7beed49275daca342e95d
BLAKE2b-256 74bff45303d68b6ea26921f5854283a3cedca85500af271310d47a82512eb168

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