learning GUI with python (PyQt4) showmessage on statusbar
Question: I am learning python.I am new to it.

<http://zetcode.com/gui/pyqt4/firstprograms/>

Right now, I am trying to make calculator for exercise. I changed a bit of
sample program. But I got error.

    
    
    Traceback (most recent call last):
      File "customCalculatorGUI.py", line 50, in buttonClicked
        self.showMessage(sender.text() + ' was pressed')
    AttributeError: 'Example' object has no attribute 'showMessage'
    

## #

    
    
    import sys
    from PyQt4 import QtGui, QtCore
    
    """
    ZetCode PyQt4 tutorial 
    
    In this example, we create a skeleton
    of a calculator using a QtGui.QGridLayout.
    
    author: Jan Bodnar
    website: zetcode.com 
    last edited: July 2014
    """
    
    class Example(QtGui.QWidget):
    
        def __init__(self):
            super(Example, self).__init__()
    
            self.initUI()
    
        def initUI(self):
    
            grid = QtGui.QGridLayout()
            self.setLayout(grid)
    
            names = ['Cls', 'Bck', '', 'Close',
                     '7', '8', '9', '/',
                    '4', '5', '6', '*',
                     '1', '2', '3', '-',
                    '0', '.', '=', '+']
    
            positions = [(i,j) for i in range(5) for j in range(4)]
    
            for position, name in zip(positions, names):
    
                if name == '':
                    continue
                button = QtGui.QPushButton(name)
                button.clicked.connect(self.buttonClicked)
                grid.addWidget(button, *position)
    
    
            self.move(300, 150)
            self.setWindowTitle('Calculator')
            self.show()
    
        def buttonClicked(self):
    
            sender = self.sender()
            self.showMessage(sender.text() + ' was pressed')
    
    def main():
        app = QtGui.QApplication(sys.argv)
        ex = Example()
        sys.exit(app.exec_())
    
    if __name__ == '__main__':
        main()
    

I checked <http://qt-project.org/doc/qt-4.8/qwidget.html>

and there is no showMessage class. But now, I do not know how to show a
message.

If I want to show message on statusbar when button is clicked. How can I do
it?


Answer: Check
[this](http://pyqt.sourceforge.net/Docs/PyQt4/qstatusbar.html#showMessage).
You will need to use an object of `statusBar` and call `showMessage` on that
object.

Did this long back, so its not a coding help. But this should guide you the
direction. Check if this helps?

