Notice
Recent Posts
Recent Comments
Link
아미(아름다운미소)
PyQt5 메뉴바(QAction 사용) 본문
PyQt5 , QAction 사용하여 menubar 만들기
#-*- coding: utf-8 -*- ''' Created on 2018. 11. 29. @author: bhm ''' from PyQt5.QtWidgets import QMainWindow, QAction, qApp, QApplication from PyQt5.QtGui import QIcon class Example(QMainWindow): def __init__(self): super().__init__() exit_action = QAction(QIcon('exit.png'), "&Exit", self) # exit_action = QAction('&Exit', self) exit_action.setShortcut('Ctrl+Q') exit_action.setStatusTip('Exit application') exit_action.triggered.connect(qApp.quit) self.statusBar() menubar = self.menuBar() fielmenu = menubar.addMenu('&File') fielmenu.addAction(exit_action) self.setGeometry(300, 300, 300, 200) self.setWindowTitle('Menubar') self.show() if __name__ == '__main__': import sys app = QApplication(sys.argv) ex = Example() sys.exit(app.exec_())
'랭귀지 > python' 카테고리의 다른 글
[pyqt5]stylesheet를 사용하지 않고 색상을 변경 (0) | 2018.12.02 |
---|---|
[python] subprocess 모듈을 이용한 명령어 실행 (0) | 2018.12.01 |
python 문자열에서 숫자만 제거 (0) | 2018.11.27 |
Python PyQt5 combobox 예제 (0) | 2018.11.26 |
python 리스트 슬라이싱 (0) | 2018.11.25 |
Comments