-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcamera.py
More file actions
executable file
·31 lines (26 loc) · 863 Bytes
/
camera.py
File metadata and controls
executable file
·31 lines (26 loc) · 863 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/python
from PyQt5.QtWidgets import *
from PyQt5.QtMultimedia import *
from PyQt5.QtMultimediaWidgets import *
import sys
class MainWindow(QMainWindow):
print("Simple camera V0.1")
def __init__(self):
super().__init__()
self.setGeometry(1207, 650, 100, 100)
self.setStyleSheet("background : #000;")
self.available_cameras = QCameraInfo.availableCameras()
self.viewfinder = QCameraViewfinder()
self.viewfinder.show()
self.setCentralWidget(self.viewfinder)
self.select_camera(0)
camera_selector = QComboBox()
self.show()
def select_camera(self, i):
self.camera = QCamera(self.available_cameras[i])
self.camera.setViewfinder(self.viewfinder)
self.camera.start()
if __name__ == "__main__" :
App = QApplication(sys.argv)
window = MainWindow()
sys.exit(App.exec())