Created
          August 26, 2015 14:17 
        
      - 
      
- 
        Save saleph/1da93e36184005a1a4e3 to your computer and use it in GitHub Desktop. 
    [qt5] text area + tool-, status- & menubar
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | __author__ = 'tom' | |
| import sys | |
| from PyQt5.QtWidgets import QMainWindow, QTextEdit, QAction, QApplication | |
| from PyQt5.QtGui import QIcon | |
| class Example(QMainWindow): | |
| def __init__(self): | |
| super().__init__() | |
| self.init_ui() | |
| def init_ui(self): | |
| text_edit = QTextEdit() | |
| self.setCentralWidget(text_edit) # occupy all space | |
| exit_action = QAction(QIcon('close.png'), 'Exit', self) | |
| exit_action.setShortcut('Ctrl+Q') | |
| exit_action.setStatusTip('Exit application') | |
| exit_action.triggered.connect(self.close) | |
| self.statusBar() | |
| menu_bar = self.menuBar() | |
| file_menu = menu_bar.addMenu('&File') | |
| file_menu.addAction(exit_action) | |
| toolbar = self.addToolBar('Exit') | |
| toolbar.addAction(exit_action) | |
| self.setGeometry(300, 300, 350, 250) | |
| self.setWindowTitle('Main window') | |
| self.show() | |
| if __name__ == "__main__": | |
| app = QApplication(sys.argv) | |
| ex = Example() | |
| sys.exit(app.exec_()) | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment