pycharm录制视频代码
时间: 2023-10-19 22:09:39 浏览: 143
Pycharm学习教程(3) 代码运行调试
这里提供一段使用pyqt5和opencv库实现录制屏幕的代码,可以在pycharm中运行。具体实现过程可以参考引用、、中提到的相关知识点。
```python
import sys
import cv2
from PyQt5.QtWidgets import QApplication, QWidget, QPushButton, QLabel, QVBoxLayout
from PyQt5.QtGui import QIcon, QPixmap, QImage
from PyQt5.QtCore import Qt, QThread, pyqtSignal, pyqtSlot
class ScreenRecorder(QThread):
change_pixmap_signal = pyqtSignal(QImage)
def __init__(self):
super().__init__()
self._run_flag = True
def run(self):
screen = QApplication.primaryScreen()
while self._run_flag:
if screen is not None:
screenshot = screen.grabWindow(0)
img = screenshot.toImage()
self
阅读全文