pdf-table-extractor/experiments/qt6_test.py

42 lines
1.2 KiB
Python

import sys
from typing import Sequence
from PySide6.QtWidgets import QApplication, QDialog, QLabel, QPushButton, QVBoxLayout
from PySide6.QtCore import Slot
class Application():
def __init__(self, argv: Sequence[str]):
self.app = QApplication(argv)
self.counter = 0
self.window = QDialog()
self.layout = QVBoxLayout(self.window)
self.label = QLabel("0")
self.button_increment = QPushButton("Increment counter!")
self.button_decrement = QPushButton("Decrement counter!")
self.window.setWindowTitle("PDF Table Extractor")
self.layout.addWidget(self.label)
self.layout.addWidget(self.button_increment)
self.layout.addWidget(self.button_decrement)
self.button_increment.clicked.connect(self.increment)
self.button_decrement.clicked.connect(self.decrement)
print(self.window.layout())
@Slot()
def increment(self):
self.counter += 1
self.label.setText(f"{self.counter}")
@Slot()
def decrement(self):
self.counter -= 1
self.label.setText(f"{self.counter}")
def exec(self):
self.window.show()
self.app.exec()
if __name__ == "__main__":
app = Application(sys.argv)
app.exec()