Issue
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.
Solution
If you use QVBoxLayout
instead of QHBoxLayout
the message is displayed. (But I wouldn't say it looks like a proper status bar).
Answered By - doru
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.