32 lines
783 B
Python
Executable File
32 lines
783 B
Python
Executable File
import sys
|
|
|
|
from PyQt6.QtWidgets import QApplication, QWidget, QPushButton
|
|
from PyQt6.QtCore import QSize
|
|
from PyQt6.QtGui import QFont, QIcon
|
|
|
|
|
|
class Window(QWidget):
|
|
def __init__(self) -> None:
|
|
super().__init__()
|
|
self.setGeometry(*(500,) * 4)
|
|
self.setWindowTitle("Окно")
|
|
self.create_button()
|
|
|
|
def create_button(self) -> None:
|
|
btn = QPushButton("Click", self)
|
|
btn.setGeometry(*(100,) * 4)
|
|
btn.setFont(QFont("Times", 14, QFont.Weight.ExtraBold))
|
|
btn.setIcon(QIcon("cat1.jpg"))
|
|
btn.setIconSize(QSize(50, 50))
|
|
|
|
|
|
def main() -> None:
|
|
app = QApplication(sys.argv)
|
|
window = Window()
|
|
window.show()
|
|
sys.exit(app.exec())
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|