Calculadora - Criando a janela principal com QMainWindow, QWidget e QVBoxLayout
This commit is contained in:
20
aula202-calculadora/main_window.py
Normal file
20
aula202-calculadora/main_window.py
Normal file
@@ -0,0 +1,20 @@
|
||||
from PySide6.QtWidgets import QMainWindow, QVBoxLayout, QWidget
|
||||
|
||||
|
||||
class MainWindow(QMainWindow):
|
||||
def __init__(self, parent: QWidget | None = None, *args, **kwargs) -> None:
|
||||
super().__init__(parent, *args, **kwargs)
|
||||
|
||||
# Configurando o layout básico
|
||||
self.cw = QWidget()
|
||||
self.v_layout = QVBoxLayout()
|
||||
self.cw.setLayout(self.v_layout)
|
||||
self.setCentralWidget(self.cw)
|
||||
|
||||
# Título da janela
|
||||
self.setWindowTitle('Calculadora')
|
||||
|
||||
def adjustFixedSize(self):
|
||||
# Última coisa a ser feita
|
||||
self.adjustSize()
|
||||
self.setFixedSize(self.width(), self.height())
|
||||
Reference in New Issue
Block a user