pyqt6Dashboard/qtDash/monitor.py

32 lines
867 B
Python

from PyQt6.QtWidgets import QApplication, QMainWindow
from PyQt6.QtGui import QGuiApplication
import sys
class MainWindow(QMainWindow):
def __init__(self):
super().__init__()
self.setWindowTitle("Dashboard")
if __name__ == "__main__":
app = QApplication(sys.argv)
# 사용 가능한 모니터 목록 가져오기
screens = QGuiApplication.screens()
print("사용 가능한 모니터 수:", len(screens))
# 예: 두 번째 모니터 선택 (인덱스 1)
target_screen_index = 1 if len(screens) > 1 else 0
target_screen = screens[target_screen_index]
# 메인 윈도우 생성
window = MainWindow()
# 선택한 모니터의 geometry로 이동
geometry = target_screen.geometry()
window.setGeometry(geometry)
# 전체화면으로 표시
window.showFullScreen()
sys.exit(app.exec())