Hey mates, it's me again.
I'm trying to develop a small application, but I'm not sure how to put two icons in the same toolbar, probably theres another way of creating toolbars instead of "self.toolbar", I'm not sure.
Check my code:
import sys
from PyQt4 import QtGui
class Routine(QtGui.QMainWindow):
def __init__(self):
super(Routine, self).__init__()
self.initUI()
def initUI(self):
saveAction = QtGui.QAction(QtGui.QIcon('images/floppy.ico'), 'Save (Ctrl+S)', self)
saveAction.setShortcut('Ctrl+S')
saveAction.triggered.connect(QtGui.qApp.quit)
self.toolbar = self.addToolBar('Save')
self.toolbar.addAction(saveAction)
exitAction = QtGui.QAction(QtGui.QIcon('images/exit.ico'), 'Exit (Ctrl+Q)', self)
exitAction.setShortcut('Ctrl+Q')
exitAction.triggered.connect(QtGui.qApp.quit)
self.toolbar = self.addToolBar('Exit')
self.toolbar.addAction(exitAction)
self.resize(300,400)
self.center()
self.setWindowTitle('PyRoutine')
self.setWindowIcon(QtGui.QIcon('images/msn.ico'))
self.show()
def center(self):
qr = self.frameGeometry()
cp = QtGui.QDesktopWidget().availableGeometry().center()
qr.moveCenter(cp)
self.move(qr.topLeft())
def main():
app = QtGui.QApplication(sys.argv)
ex = Routine()
sys.exit(app.exec_())
if __name__ == '__main__':
main()
P.S. I know the save button isn't working as it function.
My problem is there's a toolbar for each icon, I want to put both on the same, do someone know what function I use?