PySide6のQtを使ってGUIアプリを作る
PythonでもGUIアプリは作れる。 標準モジュールのtkinterと違い、より高度なものを作れる。 【関数】クリックで1ずつ増える 基本のボタン押下で1ずつ増えるコード from PySide6.QtWidgets import QApplication, QMainWindow, QPushButton app = QApplication([]) counter = 0 def click_counter(): global counter counter += 1 button.setText(f"{counter} 回押しました。") print(counter) window = QMainWindow() window.setWindowTitle("テストウィンドウ") button = QPushButton(f"{counter} 回押しました。") button.clicked.connect(click_counter) window.setCentralWidget(button) window.resize(300, 200) window.show() app.exec() このコードではクラスを使わ ...