TI/PyQt5
Z Brain-wiki
import sys
from PyQt5.QtWidgets import QApplication, QWidget, QPushButton
class App(QWidget):
def __init__(self):
super().__init__()
self.title = 'Guzik'
self.left = 10
self.top = 10
self.width = 220
self.height = 220
self.initUI()
def initUI(self):
self.setWindowTitle(self.title)
self.setGeometry(self.left, self.top, self.width, self.height)
self.guzik= QPushButton('X', self)
self.guzik.move(10,10)
self.guzik.resize(200,200)
self.guzik.clicked.connect(self.on_click)
self.show()
def on_click(self):
if self.guzik.text()=='X':
self.guzik.setText('O')
else:
self.guzik.setText('X')
if __name__ == '__main__':
app = QApplication(sys.argv)
ex = App()
sys.exit(app.exec_())