Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.23 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(self.shutdown)
  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.     def shutdown(self):
  39.         self.close()
  40.         self.quit()
  41.        
  42.        
  43.        
  44.        
  45.  
  46.        
  47. def main():
  48.  
  49.     mh=QtGui.QApplication(sys.argv)        
  50.     bsp=Beispiel()
  51.     sys.exit(mh.exec_())
  52.        
  53. if __name__ == '__main__':
  54.     main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement