[PyQt] QLabel setFont does not work

Linos info at linos.es
Fri Nov 9 11:03:37 GMT 2007


Well i have fixed using html code in qlabel.setText, i have now bold and the size i wanted but i think this is
a bug, i dont know if pyqt or qt but it seems a bug.

Linos escribió:
> Hello all,
> 	i have a problem with a QLabel i want to change the font size and make bold, i have a dialog created in
> designer where i have changed the font, i can view the change ok in the designer preview but when i launch the
> code with the dialog imported it doest not change the standard font, i cant set from code either i have tried
> this:
> 
> print self.totalCuentaLabel.font().toString()
> font = QFont("Sans Serif", 12, QFont.Bold)
> self.totalCuentaLabel.setFont(font)
> self.totalCuentaLabel.update()
> print self.totalCuentaLabel.font().toString()
> self.totalCuentaLabel.setText(QString("TOTAL CUENTA:"))
> font = QFont("Sans Serif", 12, QFont.Bold)
> self.totalCuentaLabel.setFont(font)
> print self.totalCuentaLabel.font().toString()
> 
> and i get this output:
> 
>>>> Times New Roman,12,-1,5,75,0,0,0,0,0
> Sans Serif,12,-1,5,75,0,0,0,0,0
> Sans Serif,12,-1,5,75,0,0,0,0,0
> 
> the first font it is from designer but it does not work either. i ever view in the dialog my standard qlabel
> font "Sans Serif,9", anyone know how to fix this? Thanks in advance.
> _______________________________________________
> PyQt mailing list    PyQt at riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt



More information about the PyQt mailing list