Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2018
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.16 KB | None | 0 0
  1. import sys
  2. from PyQt4 import QtGui
  3.  
  4.  
  5.  
  6. class Beispiel(QtGui.QMainWindow):
  7.  
  8. def __init__(self):
  9. super(Beispiel, self).__init__()
  10.  
  11. self.erstelleUI()
  12.  
  13. def erstelleUI(self):
  14. self.statusBar().showMessage("Ready")
  15.  
  16. self.setGeometry(300,300,300,300)
  17. self.setWindowTitle("Fenster")
  18. self.show()
  19.  
  20. exitAction=QtGui.QAction(QtGui.QIcon("exit.png"),"&Exit",self)
  21. exitAction.setShortcut("Ctrl+Q")
  22. exitAction.setStatusTip("Exit application")
  23. exitAction.triggered.connect(QtGui.qApp.quit)
  24.  
  25. self.statusBar()
  26.  
  27. menubar=self.menuBar()
  28.  
  29. fileMenu=menubar.addMenu("&File")
  30. fileMenu.addAction(exitAction)
  31. fileMenu2=menubar.addMenu("&Hallo")
  32. fileMenu2.addAction("Hi")
  33.  
  34.  
  35. self.toolbar=self.addToolBar("Exit")
  36. self.toolbar.addAction(exitAction)
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43. def main():
  44.  
  45. mh=QtGui.QApplication(sys.argv)
  46. bsp=Beispiel()
  47. sys.exit(mh.exec())
  48.  
  49. if __name__ == '__main__':
  50. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement