I'm a beginner in Pyqt and I made the main form but I don't know how to modify the size and the type of the font in the Qlabel?
def __init__(self):
QtGui.QMainWindow.__init__(self)
self.center()
self.setWindowTitle('GBLtda Database')
self.setStyleSheet("background-color: white")
self.resize(1028, 720)
label = QtGui.QLabel('GB DATABASE', self)
label.move(15, 10)
self.setWindowIcon(QtGui.QIcon('db.png'))
Using stylesheets:
#for the whole widget
self.setStyleSheet("QLabel {font: 30pt Comic Sans MS}")
#Just for this label
label.setStyleSheet("font: 30pt Comic Sans MS")
The simplest way is to set the font using setFont(QFont)
method.
label.setFont(QFont('Arial', 20))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With