From 762d99dc02066555f723b9537c65330f8bf9d10f Mon Sep 17 00:00:00 2001 From: Anthony Wang Date: Fri, 12 Apr 2024 20:03:52 -0400 Subject: Add PyQt6 stuff and requirements.txt --- encoder.py | 44 ++++++++++++++++++++++++++++++++++++++++++++ requirements.txt | 8 ++++++++ 2 files changed, 52 insertions(+) create mode 100644 encoder.py create mode 100644 requirements.txt diff --git a/encoder.py b/encoder.py new file mode 100644 index 0000000..c5d76e1 --- /dev/null +++ b/encoder.py @@ -0,0 +1,44 @@ +import sys +import numpy as np +from PyQt6.QtWidgets import QApplication, QWidget, QLabel, QVBoxLayout +from PyQt6.QtGui import QPixmap +from PyQt6.QtCore import QTimer +from PIL import Image, ImageQt + +fps = 30 +h = 200 +w = 200 +c = 0 + + +class EncoderWidget(QWidget): + def __init__(self): + super().__init__() + self.timer = QTimer(self) + self.timer.timeout.connect(self.update) + self.timer.start(1000 // fps) + self.label = QLabel(self) + layout = QVBoxLayout(self) + layout.addWidget(self.label) + layout.setContentsMargins(0, 0, 0, 0) + self.setLayout(layout) + self.showFullScreen() + + def update(self): + global c + if c == 0: + array = np.random.randint(0, 256, (h, w, 3)) + c = 1 + else: + array = np.zeros((h, w, 3)) + c = 0 + img = Image.fromarray(array.astype(np.uint8), mode="RGB") + qt_img = ImageQt.ImageQt(img) + pixmap = QPixmap.fromImage(qt_img).scaled(self.size()) + self.label.setPixmap(pixmap) + + +if __name__ == "__main__": + app = QApplication(sys.argv) + widget = EncoderWidget() + sys.exit(app.exec()) diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..e1ef11e --- /dev/null +++ b/requirements.txt @@ -0,0 +1,8 @@ +Cython==3.0.10 +numpy==1.26.4 +pillow==10.3.0 +PyQt6==6.6.1 +PyQt6-Qt6==6.6.3 +PyQt6-sip==13.6.0 +raptorq==2.0.0 +reedsolo==1.7.0 -- cgit v1.2.3-70-g09d2