Reputation: 1145
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)
Upvotes: 0
Views: 53
Reputation: 2763
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)
Upvotes: 0
Reputation: 369074
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.
Upvotes: 1