import os
import numpy as np
import matplotlib.pyplot as plt
import sys
import math
from PyQt5.QtWidgets import QApplication, QWidget, QLabel, QVBoxLayout, QLineEdit, QTextEdit, QGridLayout, QPushButton
from PyQt5.QtGui import QPainter, QPen, QColor, QBrush
from PyQt5.QtCore import Qt, QTimer
import time
import threading
class MyApp(QWidget):
def __init__(self):
super().__init__()
self.initUI()
def initUI(self):
self.setWindowTitle('Ahn_Youngman')
self.grid = []
grid = QGridLayout()
self.setLayout(grid)
for i in range(15):
p = []
for j in range(15):
v = QPushButton()
v.setFixedSize(50, 50)
v.clicked.connect(lambda: self.click(v))
p.append(v)
grid.addWidget(v, i-1, j-1)
self.grid.append(p)
self.resize(800, 800)
self.show()
def click(self, x, y):
print(f'clicked coordinates {x} and {y}')
if __name__ == '__main__':
app = QApplication(sys.argv)
ex = MyApp()
sys.exit(app.exec_())
top of page
기능을 테스트하려면 라이브 사이트로 이동하세요.
그리드
그리드
댓글 0개
좋아요
댓글(0)
bottom of page