本文整理汇总了Python中PyQt5.QtWidgets.qApp.quit方法的典型用法代码示例。如果您正苦于以下问题:Python qApp.quit方法的具体用法?Python qApp.quit怎么用?Python qApp.quit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtWidgets.qApp
的用法示例。
在下文中一共展示了qApp.quit方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: new_session_dialog
# 需要导入模块: from PyQt5.QtWidgets import qApp [as 别名]
# 或者: from PyQt5.QtWidgets.qApp import quit [as 别名]
def new_session_dialog(self):
"""Show the layout-selection dialog"""
try:
# Prompt the user for a new layout
dialog = LayoutSelect()
if dialog.exec_() != QDialog.Accepted:
if self._layout is None:
# If the user close the dialog, and no layout exists
# the application is closed
self.finalize()
qApp.quit()
exit()
else:
return
# If a valid file is selected load it, otherwise load the layout
if exists(dialog.filepath):
self._load_from_file(dialog.filepath)
else:
self._new_session(dialog.selected())
except Exception as e:
elogging.exception('Startup error', e)
qApp.quit()
exit(-1)
示例2: initMenuBar
# 需要导入模块: from PyQt5.QtWidgets import qApp [as 别名]
# 或者: from PyQt5.QtWidgets.qApp import quit [as 别名]
def initMenuBar(self):
'''
初始化菜单栏
'''
menubar = self.menuBar()
#self.actionExit.triggered.connect(qApp.quit) # 按下菜单栏的Exit按钮会退出程序
#self.actionExit.setStatusTip("退出程序") # 左下角状态提示
#self.actionExit.setShortcut('Ctrl+Q') # 添加快捷键
exitAct = QAction(QIcon('exit.png'), 'Exit', self)
exitAct.setShortcut('Ctrl+Q')
exitAct.triggered.connect(qApp.quit)
fileMenu = menubar.addMenu('&File')
fileMenu.addAction(exitAct)
fileMenu = menubar.addMenu('&Help')
示例3: initUI
# 需要导入模块: from PyQt5.QtWidgets import qApp [as 别名]
# 或者: from PyQt5.QtWidgets.qApp import quit [as 别名]
def initUI(self):
exitAct = QAction(QIcon('exit.png'), '&Exit', self)
exitAct.setShortcut('Ctrl+Q')
exitAct.setStatusTip('Exit application')
exitAct.triggered.connect(qApp.quit)
self.statusBar()
menubar = self.menuBar()
fileMenu = menubar.addMenu('&File')
fileMenu.addAction(exitAct)
self.setGeometry(300, 300, 300, 200)
self.setWindowTitle('Simple menu')
self.show()
示例4: ButtonAct
# 需要导入模块: from PyQt5.QtWidgets import qApp [as 别名]
# 或者: from PyQt5.QtWidgets.qApp import quit [as 别名]
def ButtonAct(self):
global ulist
sender = self.sender()
ulist += sender.text()
if sender.text() == '=':
value = eval(ulist.replace('=',''))
if value:
self.Line.setText(str(value))
ulist = str(value)
elif sender.text() == 'close':
qApp.quit()
elif sender.text() == 'cls':
ulist = ''
elif sender.text() == 'bck':
ulist = ulist[:-4]
elif sender.text() == 'plus':
ulist = ulist[:-4]
self.Text.setText(ulist)
# execute our application
示例5: initToolBar
# 需要导入模块: from PyQt5.QtWidgets import qApp [as 别名]
# 或者: from PyQt5.QtWidgets.qApp import quit [as 别名]
def initToolBar(self):
'''
初始化工具栏
创建一个QAction实例exitAct,然后添加到designer已经创建的默认的工具栏toolBar里面
'''
exitAct = QAction(QIcon('exit.png'), 'Exit', self)
exitAct.setShortcut('Ctrl+Q')
exitAct.triggered.connect(qApp.quit)
self.toolBar.addAction(exitAct)
示例6: contextMenuEvent
# 需要导入模块: from PyQt5.QtWidgets import qApp [as 别名]
# 或者: from PyQt5.QtWidgets.qApp import quit [as 别名]
def contextMenuEvent(self, event):
cmenu = QMenu(self)
newAct = cmenu.addAction("New")
opnAct = cmenu.addAction("Open")
quitAct = cmenu.addAction("Quit")
action = cmenu.exec_(self.mapToGlobal(event.pos()))
if action == quitAct:
qApp.quit()
示例7: initUI
# 需要导入模块: from PyQt5.QtWidgets import qApp [as 别名]
# 或者: from PyQt5.QtWidgets.qApp import quit [as 别名]
def initUI(self):
exitAct = QAction(QIcon('exit24.png'), 'Exit', self)
exitAct.setShortcut('Ctrl+Q')
exitAct.triggered.connect(qApp.quit)
self.toolbar = self.addToolBar('Exit')
self.toolbar.addAction(exitAct)
self.setGeometry(300, 300, 300, 200)
self.setWindowTitle('Toolbar')
self.show()
示例8: quitApp
# 需要导入模块: from PyQt5.QtWidgets import qApp [as 别名]
# 或者: from PyQt5.QtWidgets.qApp import quit [as 别名]
def quitApp(self):
# 退出程序
self.w.show() # w.hide() #设置退出时是否显示主窗口
re = QMessageBox.question(self.w, "提示", "确认退出?", QMessageBox.Yes |
QMessageBox.No, QMessageBox.No)
if re == QMessageBox.Yes:
self.tp.setVisible(False) # 隐藏托盘控件
qApp.quit() # 退出程序
self.w.v2rayL.disconnect()
示例9: checkPLAYMODE
# 需要导入模块: from PyQt5.QtWidgets import qApp [as 别名]
# 或者: from PyQt5.QtWidgets.qApp import quit [as 别名]
def checkPLAYMODE(self):
while self.btnset.PLAYMODE == Constants.playmode_pause:
loop = QEventLoop()
QTimer.singleShot(10, loop.quit)
loop.exec_()
示例10: menubtn0_clicked
# 需要导入模块: from PyQt5.QtWidgets import qApp [as 别名]
# 或者: from PyQt5.QtWidgets.qApp import quit [as 别名]
def menubtn0_clicked(self):
print("clicked pb_1")
qApp.quit()
sys.exit(0)
示例11: pb_1_clicked
# 需要导入模块: from PyQt5.QtWidgets import qApp [as 别名]
# 或者: from PyQt5.QtWidgets.qApp import quit [as 别名]
def pb_1_clicked(self):
print("clicked pb_1")
qApp.quit()
sys.exit(0)
示例12: show
# 需要导入模块: from PyQt5.QtWidgets import qApp [as 别名]
# 或者: from PyQt5.QtWidgets.qApp import quit [as 别名]
def show(param, msg="done", time=300):
loop = QEventLoop()
QTimer.singleShot(time, loop.quit)
loop.exec_()
graphics.update(param)
graphics.setVisible(True)
示例13: closeEvent
# 需要导入模块: from PyQt5.QtWidgets import qApp [as 别名]
# 或者: from PyQt5.QtWidgets.qApp import quit [as 别名]
def closeEvent(self, event):
'''
Shows a message box to confirm the wondow closing
'''
reply = QMessageBox.question(self, 'Message',
"Are you sure to quit?", QMessageBox.Yes |
QMessageBox.No, QMessageBox.No)
if reply == QMessageBox.Yes:
event.accept()
else:
event.ignore()
示例14: initUi
# 需要导入模块: from PyQt5.QtWidgets import qApp [as 别名]
# 或者: from PyQt5.QtWidgets.qApp import quit [as 别名]
def initUi(self):
# 提示数值范围
self.label.setText('数值的范围是:{}-{}'.format(self.left, self.right))
# 按下按钮一,运行 self.guess 函数
self.pushButton.clicked.connect(self.guess)
# 按下按钮二,运行 quit 函数
self.pushButton_2.clicked.connect(qApp.quit)
# 按下按钮三,运行 self.reset 函数
self.pushButton_3.clicked.connect(self.reset)
示例15: keyPressEvent
# 需要导入模块: from PyQt5.QtWidgets import qApp [as 别名]
# 或者: from PyQt5.QtWidgets.qApp import quit [as 别名]
def keyPressEvent(self, e):
# 设置快捷键
if e.key() == Qt.Key_Return:
self.guess()
elif e.key() == Qt.Key_Escape:
qApp.quit()
elif e.key() == Qt.Key_R:
self.reset()