'PyQt5: Pass a value into QWidget

how do you pass a value into a QWidget in PyQt5? Let's say everytime the user runs the GUI, the widget shows today's date for example.

Appreciate the help!!



Solution 1:[1]

from PyQt5.QtWidgets import QApplication
from PyQt5 import QtWidgets
from datetime import date

app = QApplication(['Show Date'])
today = date.today()
window = QtWidgets.QLabel(f'This QLabel shows the actual date: {today}')
window.show()
app.exec()

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 arise21