Calculadora: criando um QLabel para mostrar informações
This commit is contained in:
13
aula202-calculadora/info.py
Normal file
13
aula202-calculadora/info.py
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
from PySide6.QtCore import Qt
|
||||||
|
from PySide6.QtWidgets import QLabel, QWidget
|
||||||
|
from variables import SMALL_FONT_SIZE
|
||||||
|
|
||||||
|
|
||||||
|
class Info(QLabel):
|
||||||
|
def __init__(self, text: str, parent: QWidget | None = None) -> None:
|
||||||
|
super().__init__(text, parent)
|
||||||
|
self.configStyle()
|
||||||
|
|
||||||
|
def configStyle(self):
|
||||||
|
self.setStyleSheet(f'font-size: {SMALL_FONT_SIZE}px;')
|
||||||
|
self.setAlignment(Qt.AlignmentFlag.AlignRight)
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
import sys
|
import sys
|
||||||
|
|
||||||
from display import Display
|
from display import Display
|
||||||
|
from info import Info
|
||||||
from main_window import MainWindow
|
from main_window import MainWindow
|
||||||
from PySide6.QtGui import QIcon
|
from PySide6.QtGui import QIcon
|
||||||
from PySide6.QtWidgets import QApplication
|
from PySide6.QtWidgets import QApplication
|
||||||
@@ -16,6 +17,10 @@ if __name__ == '__main__':
|
|||||||
window.setWindowIcon(icon)
|
window.setWindowIcon(icon)
|
||||||
app.setWindowIcon(icon)
|
app.setWindowIcon(icon)
|
||||||
|
|
||||||
|
# Info
|
||||||
|
info = Info('2.0 ^ 10.0 = 1024')
|
||||||
|
window.addToVLayout(info)
|
||||||
|
|
||||||
# Display
|
# Display
|
||||||
display = Display()
|
display = Display()
|
||||||
window.addToVLayout(display)
|
window.addToVLayout(display)
|
||||||
|
|||||||
Reference in New Issue
Block a user