lanrat
lanrat

Reputation: 4694

Having trouble updating the statusBar in PyQt4

I am new to PyQt4 and am trying to allow my program to set a different message on the statusbar ad different times throughout the program, but I can't ever seem to get any text to appear on it.

The GUI was designed in Qt Designer, in the file generated by pyuic, It gives me:

self.statusbar = QtGui.QStatusBar(MainWindow)
self.statusbar.setObjectName(_fromUtf8("statusbar"))
MainWindow.setStatusBar(self.statusbar)

Inside the setupUI Function.

When I call self.ui.statusBar.showMessage('Ready') It returns:

AttributeError: 'builtin_function_or_method' object has no attribute 'showMessage'

But when I call:

    self.ui.statusBar().showMessage('Ready')

I get no errors, but the statusbar remains blank and does not display "Ready".

Can anyone point out what I am doing wrong or missing?

Thanks!

Upvotes: 0

Views: 4436

Answers (1)

Artur Gaspar
Artur Gaspar

Reputation: 4552

You are not calling statusBar.
With self.statusBar.showMessage('Ready'), you are calling the showMessage attribute of the statusBar method.
You should use self.statusBar().showMessage('Ready'), where you get the status bar calling the statusBar method.

Upvotes: 4

Related Questions