VNC QT Widget for Python using PyQt5
Project description
pyQVNCWidget
VNC Widget for Python using PyQt5
NOTE: This project is pretty much still in WiP status and I am struggling with the PIXEL_FORMAT.
So if someone knows a way to fix it or a better way of doing it in the first place, I would be happy about PRs ;)
How to install
pip3 install qvncwidget
TODO:
- 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 PyQt5.QtWidgets import QApplication, QMainWindow
from qvncwidget import QVNCWidget
class Window(QMainWindow):
def __init__(self):
super(Window, self).__init__()
self.initUI()
def initUI(self):
self.setWindowTitle("QVNCWidget")
self.vnc = QVNCWidget(
parent=self,
host="127.0.0.1", port=5900,
password="1234"
)
self.setCentralWidget(self.vnc)
self.vnc.start()
app = QApplication(sys.argv)
window = Window()
#window.setFixedSize(800, 600)
window.resize(800, 600)
window.show()
sys.exit(app.exec_())
Example with key input (since 0.2.0)
import sys
from PyQt5.QtWidgets import QApplication, QMainWindow
from PyQt5.QtGui import QKeyEvent
from qvncwidget import QVNCWidget
class Window(QMainWindow):
def __init__(self, app: QApplication):
super(Window, self).__init__()
self.app = app
self.initUI()
def initUI(self):
self.setWindowTitle("QVNCWidget")
self.vnc = QVNCWidget(
parent=self,
host="127.0.0.1", port=5900,
password="1234"
)
self.setCentralWidget(self.vnc)
self.vnc.start()
def keyPressEvent(self, ev: QKeyEvent):
self.vnc.onKeyPress.emit(ev)
def keyReleaseEvent(self, ev: QKeyEvent):
self.vnc.onKeyRelease.emit(ev)
app = QApplication(sys.argv)
window = Window(app)
window.resize(800, 600)
window.show()
sys.exit(app.exec_())
Example with key input and mouse tracking (since 0.2.3)
import sys
from PyQt5.QtWidgets import QApplication, QMainWindow
from PyQt5.QtGui import QKeyEvent
from qvncwidget import QVNCWidget
class Window(QMainWindow):
def __init__(self, app: QApplication):
super(Window, self).__init__()
self.app = app
self.initUI()
def initUI(self):
self.setWindowTitle("QVNCWidget")
self.vnc = QVNCWidget(
parent=self,
host="127.0.0.1", port=5900,
password="1234",
mouseTracking=True
)
self.setCentralWidget(self.vnc)
self.vnc.onInitialResize.connect(self.resize)
self.vnc.start()
def keyPressEvent(self, ev: QKeyEvent):
self.vnc.onKeyPress.emit(ev)
def keyReleaseEvent(self, ev: QKeyEvent):
self.vnc.onKeyRelease.emit(ev)
app = QApplication(sys.argv)
window = Window(app)
window.resize(800, 600)
window.show()
sys.exit(app.exec_())
References
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
qvncwidget-0.2.4.tar.gz
(31.6 kB
view hashes)
Built Distribution
qvncwidget-0.2.4-py3-none-any.whl
(34.8 kB
view hashes)
Close
Hashes for qvncwidget-0.2.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 81b977a23561ebb758fda080b66effd744251d1fa691568229ede6a60337d592 |
|
MD5 | 3372788c98ac2126361329c1a9666d2d |
|
BLAKE2b-256 | 30e97ccb466c6fa41e45b836bc66ca535853462656028759be339926ff3f8d76 |