qt5 toolbar 설정 및 icon 변경 하는 프로그램입니다.
관련된 부분에 대해서 copy 하였습니다,
어느정도 아시면 충분히 이해할 것이라 생각합니다.
def ui_common(self):
self.setupUi(self)
filename = os.path.basename(os.path.realpath(sys.argv[0]))
# dirname=os.path.dirname(os.path.realpath(sys.argv[0]))
self.setWindowTitle(filename)
self.setGeometry(self.x(), self.y(), self.width(), self.height())
# self.setGeometry(self.x(), self.y(), self.width() * 3 / 4, self.height() / 2)
# ToolBar configuration
self.exitAction = QAction(QIcon('exit.png'), 'Exit', self)
self.exitAction.setShortcut('Ctrl+Q')
self.exitAction.setStatusTip('Exit application')
self.exitAction.triggered.connect(self.close)
self.PausePlay = QAction(QIcon('stop_play.png'), 'Play or Stop')
self.PausePlay.setCheckable(True)
self.PausePlay.setStatusTip('stop/play')
self.PausePlay.triggered[bool].connect(self.playing)
# ToolBar
self.toolbar = self.addToolBar('Standard')
self.toolbar.addAction(self.exitAction)
self.toolbar.addAction(self.PausePlay)
# self.toolbar = self.addToolBar('tb')
# self.toolbar.addAction(self.PausePlay)
# MenuBar
self.menubar = self.menuBar()
self.fileMenu = self.menubar.addMenu('&File')
self.fileMenu.addAction(self.exitAction)
# StatusBar
self.statusBar().showMessage('Ready')
def playing(self, active):
if not active :
self.PausePlay.setIcon(QIcon("play.png"))
self.PausePlay.setStatusTip('Play')
else:
self.PausePlay.setIcon(QIcon("stop.png"))
self.PausePlay.setStatusTip('Stop')
'언어 > Python' 카테고리의 다른 글
Python csv 파일 읽어오기 (0) | 2021.01.19 |
---|---|
Python Logger 사용 (0) | 2021.01.19 |
Python qt5 Dialog modal modalness 적용 방법 (1) | 2019.08.16 |
국제 금/은/구리 및 텍사스/두바이 중질유 석유값 가져 오기 (0) | 2019.08.16 |
Python email 보내기 ( google smtp server 사용) (0) | 2018.06.14 |