Question

I wrote the following code but when I run the program only appears two letters of the main title. Anybody knows how to fix it?

class Window(QtGui.QMainWindow):
    def __init__(self):
        QtGui.QMainWindow.__init__(self)
    #self.center()
    self.setStyleSheet("background-color: white")
    self.resize(1028, 720)
    self.setWindowTitle('GBLtda Database')
    label = QtGui.QLabel('GB DATABASE', self)
    label.setStyleSheet("font: 50pt AGENTORANGE") 
        label.move(20, 20)
Was it helpful?

Solution 2

Try this:

label.resize(514, 360)

The first is the width in pixels, and the second is the height - you want the height to be at least 10% more than the font size, so 55 is the minimum number for that. (obviously, change the values to suit what you like)

OTHER TIPS

Becase the label widgets does not resize.

You need to resize it using resize method after changing font.

...
label.setStyleSheet("font: 50pt AGENTORANGE") 
label.resize(label.sizeHint()) # <-----
label.move(20, 20)

Or, you can put the label inside the layout object.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top