o1-preview-2024-09-12· OpenAI
WildChat-4.8M (AI2)
화면 중앙에 십자 조준선 오버레이 띄워주는 파이썬 코드 작성해 설명없이 코드만 딱줘
- User
화면 중앙에 십자 조준선 오버레이 띄워주는 파이썬 코드 작성해 설명없이 코드만 딱줘
- Assistant
import sys from PyQt5.QtWidgets import QApplication, QWidget from PyQt5.QtGui import QPainter, QPen from PyQt5.QtCore import Qt class CrosshairOverlay(QWidget): def __init__(self): super().__init__() self.setWindowFlags(Qt.WindowStaysOnTopHint | Qt.FramelessWindowHint | Qt.WindowTransparentForInput) self.setAttribute(Qt.WA_TranslucentBackground) screen = QApplication.primaryScreen().geometry() self.setGeometry(screen) self.show() def paintEvent(self, event): painter = QPainter(self) pen = QPen(Qt.red, 2) painter.setPen(pen) center = self.rect().center() painter.drawLine(center.x() - 20, center.y(), center.x() + 20, center.y()) painter.drawLine(center.x(), center.y() - 20, center.x(), center.y() + 20) if __name__ == '__main__': app = QApplication(sys.argv) overlay = CrosshairOverlay() sys.exit(app.exec_())