본문 바로가기
Study(매일매일한걸음씩)/Python

#1 아무것도 모른 상태에서 처음 하는 Python GUI(PySide6) - 버튼 만들기

by 여유러운백수삶개발자 2023. 1. 11.
버튼 만들기
from PySide6.QtWidgets import QApplication, QMainWindow, QPushButton

import sys

app = QApplication(sys.argv)

window = QMainWindow()
window.setWindowTitle("push button box")

button = QPushButton()
button.setText("Press me")

window.setCentralWidget(button)

window.show()
app.exec()

결과

The QApplication class manages the GUI application’s control flow and main settings.
The QMainWindow class provides a main application window
The QPushButton widget provides a command button

https://doc.qt.io/qtforpython/PySide6/QtWidgets/QApplication.html#PySide6.QtWidgets.PySide6.QtWidgets.QApplicationoc.qt.io/qt-6/qmainwindow.html

 

QMainWindow Class | Qt Widgets 6.4.2

 

doc.qt.io

https://doc.qt.io/qtforpython/PySide6/QtWidgets/QMainWindow.html#more

 

QMainWindow - Qt for Python

Previous QListWidgetItem

doc.qt.io

https://doc.qt.io/qtforpython/PySide6/QtWidgets/QPushButton.html

 

QPushButton - Qt for Python

Previous QProxyStyle

doc.qt.io

import sys
This module provides access to some variables used or maintained by the interpreter and to functions that interact strongly with the interpreter. It is always available.

https://docs.python.org/3/library/sys.html

 

sys — System-specific parameters and functions

This module provides access to some variables used or maintained by the interpreter and to functions that interact strongly with the interpreter. It is always available. Citations C99, ISO/IEC 9899...

docs.python.org

 

window.setWindowTitle("push button box")

 


간단하지만 알면 알수록 어려운것 같다.

아래것들은 뭔지(계속 공부가 필요하겠다)

하나하나씩 공부해보자

댓글