QLabel not showing text

by: m1rx, 9 years ago

Last edited: 9 years ago

Hello
im following the great PyQt courses ( https://pythonprogramming.net/application-structure-pyqt-tutorial/ )
but i tried to add a text string using QLabel
well, i do the same in this page above: https://pythonprogramming.net/application-structure-pyqt-tutorial/ and added
<pre class='prettyprint lang-py'>
class Window(QtGui.QMainWindow):

    def __init__(self):
        super(Window, self).__init__()
        self.setGeometry(50, 50, 500, 300)
        self.setWindowTitle("PyQT tuts!")
        self.setWindowIcon(QtGui.QIcon('pythonlogo.png'))
        self.show()
        label = QtGui.QLabel ("hello world")
        label.move(150, 100)
        label.show()
app = QtGui.QApplication(sys.argv)
GUI = Window()
sys.exit(app.exec_())
</pre>

but it show nothing :(



You must be logged in to post. Please login or register an account.



ah i fixed it, the problem i forget to do
QGui.QLabel("hello world", self)
instead of that
/lock please

-m1rx 9 years ago

You must be logged in to post. Please login or register an account.