João Paulo
João Paulo

Reputation: 6670

Status bar not showing message

Look the simple code below. I'm just trying to show a message at Status bar and It's not displaying. It's not returning erros... just don't display the message.

class myForm(QtGui.QWidget):

  status_bar = None

  def __init__(self):
    super(myForm, self).__init__()
    self.InitializeComponent()

  def InitializeComponent(self):
    self.status_bar = QtGui.QStatusBar()
    hbox_status_bar = QtGui.QHBoxLayout()
    hbox_status_bar.addStretch(1)
    hbox_status_bar.addWidget(self.status_bar)
    self.setLayout(hbox_status_bar)
    self.showMessage("Hello!")
    self.show()

  def showMessage(self, msg):
    self.status_bar.showMessage(msg)

if __name__ == '__main__':
    app = QtGui.QApplication(sys.argv)
    ex = myForm()
    sys.exit(app.exec_())

My form can't be QMainWindow.

Upvotes: 0

Views: 436

Answers (1)

doru
doru

Reputation: 9110

If you use QVBoxLayout instead of QHBoxLayout the message is displayed. (But I wouldn't say it looks like a proper status bar).

Upvotes: 1

Related Questions