本文整理汇总了Python中PySide2.QtWidgets.QApplication.exec_方法的典型用法代码示例。如果您正苦于以下问题:Python QApplication.exec_方法的具体用法?Python QApplication.exec_怎么用?Python QApplication.exec_使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PySide2.QtWidgets.QApplication
的用法示例。
在下文中一共展示了QApplication.exec_方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from PySide2.QtWidgets import QApplication [as 别名]
# 或者: from PySide2.QtWidgets.QApplication import exec_ [as 别名]
def main():
app = QApplication(sys.argv)
window = MainWindow()
window.show()
app.exec_()
示例2: main
# 需要导入模块: from PySide2.QtWidgets import QApplication [as 别名]
# 或者: from PySide2.QtWidgets.QApplication import exec_ [as 别名]
def main():
app = QApplication([])
QtWebEngine.initialize()
engine = QQmlApplicationEngine()
qml_file_path = os.path.join(os.path.dirname(__file__), 'browser.qml')
qml_url = QUrl.fromLocalFile(os.path.abspath(qml_file_path))
engine.load(qml_url)
app.exec_()
示例3: testIt
# 需要导入模块: from PySide2.QtWidgets import QApplication [as 别名]
# 或者: from PySide2.QtWidgets.QApplication import exec_ [as 别名]
def testIt(self):
app = QApplication([])
self.box = MySpinBox()
self.box.show()
QTimer.singleShot(0, self.sendKbdEvent)
QTimer.singleShot(100, app.quit)
app.exec_()
self.assertEqual(self.box.text(), '0')
示例4: run_main
# 需要导入模块: from PySide2.QtWidgets import QApplication [as 别名]
# 或者: from PySide2.QtWidgets.QApplication import exec_ [as 别名]
def run_main():
import sys
from PySide2.QtWidgets import QApplication
app = QApplication(sys.argv)
mw = AddressWidget()
mw.show()
sys.exit(app.exec_())
示例5: main
# 需要导入模块: from PySide2.QtWidgets import QApplication [as 别名]
# 或者: from PySide2.QtWidgets.QApplication import exec_ [as 别名]
def main():
global dbus
parser = ArgumentParser()
parser.add_argument("-v", "--verbose", help="increase output verbosity",
action="store_true")
args = parser.parse_args()
QtQml.qmlRegisterType(QmlPage, "djpdf", 1, 0, "DjpdfPage")
app = QApplication([])
engine = QQmlApplicationEngine()
thumbnail_image_provider = ThumbnailImageProvider()
engine.addImageProvider("thumbnails", thumbnail_image_provider)
ctx = engine.rootContext()
pages_model = QmlPagesModel(verbose=args.verbose)
if os.environ.get("DJPDF_PLATFORM_INTEGRATION", "") == "flatpak":
import dbus
import dbus.mainloop.glib
dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
bus = dbus.SessionBus()
platform_integration = QmlFlatpakPlatformIntegration(bus)
else:
platform_integration = QmlPlatformIntegration()
ctx.setContextProperty("pagesModel", pages_model)
ctx.setContextProperty("platformIntegration", platform_integration)
engine.load(QUrl.fromLocalFile(
os.path.join(QML_DIR, "main.qml")))
if os.environ.get("DJPDF_PLATFORM_INTEGRATION", "") == "flatpak":
platform_integration.win_id = engine.rootObjects()[0].winId()
exit(app.exec_())
示例6: main
# 需要导入模块: from PySide2.QtWidgets import QApplication [as 别名]
# 或者: from PySide2.QtWidgets.QApplication import exec_ [as 别名]
def main():
# load options from cmdline
parser = create_parser()
args = parser.parse_args()
# set debug levels
LEVELS = {
'notset': logging.NOTSET,
'debug': logging.DEBUG,
'info': logging.INFO,
'warning': logging.WARNING,
'error': logging.ERROR,
'critical': logging.CRITICAL,
}
level_name = 'info'
if args.debug:
level_name = args.debug
level = LEVELS.get(level_name, logging.INFO)
# now get the logger used in the common module and set its level to what
# we get from sys.argv
commonlogger.setLevel(level)
logger.setLevel(level)
formatter = logging.Formatter('[%(levelname)s] %(name)s %(message)s')
handler = logging.StreamHandler(stream=sys.stdout)
handler.setFormatter(formatter)
handler.setLevel(logging.DEBUG)
logger.addHandler(handler)
commonlogger.addHandler(handler)
app = QApplication(sys.argv)
frame = MainWindow()
# args is defined at the top of this module
if not args.hidden:
# Need to fix showing wrong window
frame.show()
sys.exit(app.exec_())
示例7: main
# 需要导入模块: from PySide2.QtWidgets import QApplication [as 别名]
# 或者: from PySide2.QtWidgets.QApplication import exec_ [as 别名]
def main():
app = QApplication(sys.argv)
root = coin.SoSeparator()
vert = coin.SoVertexShader()
vert.sourceProgram = "vertex.glsl"
frag = coin.SoFragmentShader()
frag.sourceProgram = "frag.glsl"
shaders = [vert,frag]
pro = coin.SoShaderProgram()
pro.shaderObject.setValues(0,len(shaders),shaders)
mat = coin.SoMaterial()
mat.diffuseColor.setValue(coin.SbColor(0.8, 0.8, 0.8))
mat.specularColor.setValue(coin.SbColor(1, 1, 1))
mat.shininess.setValue(1.0)
mat.transparency.setValue(0.5)
sphere = coin.SoSphere()
sphere.radius = 1.2
root.addChild(pro)
root.addChild(sphere)
root.addChild(mat)
root.addChild(coin.SoCube())
viewer = quarter.QuarterWidget()
viewer.setSceneGraph(root)
viewer.setWindowTitle("minimal")
viewer.show()
sys.exit(app.exec_())
示例8: TilePad
# 需要导入模块: from PySide2.QtWidgets import QApplication [as 别名]
# 或者: from PySide2.QtWidgets.QApplication import exec_ [as 别名]
class TilePad(object):
Instance = None
@staticmethod
def Run():
TilePad.Instance = TilePad()
return TilePad.Instance.run()
def __init__(self):
QCoreApplication.setOrganizationName('DynArt')
QCoreApplication.setApplicationName('TilePad')
QCoreApplication.setApplicationVersion('0.4.0')
if getattr(sys, 'frozen', False):
self.dir = os.path.dirname(sys.executable)
else:
self.dir = os.path.dirname(__file__)
self.dir = self.dir.replace('\\', '/')
self.qApp = QApplication(sys.argv)
self.mainWindow = MainWindow(self)
def run(self):
self.mainWindow.show()
return self.qApp.exec_()
示例9: get_neighbors
# 需要导入模块: from PySide2.QtWidgets import QApplication [as 别名]
# 或者: from PySide2.QtWidgets.QApplication import exec_ [as 别名]
#get all ip adresses in the lan
host_list = get_neighbors()
print(host_list)
col_getter = [ {"Name": "Dev", "Getter": lambda aHostItem: aHostItem["dev"]},
{"Name": "Ip", "Getter": lambda aHostItem: aHostItem["ip"]},
{"Name": "Mac", "Getter": lambda aHostItem: aHostItem["mac"]}, ]
host_table = QTableView()
host_model = HostModel(host_list, col_getter, host_table)
host_table.setModel(host_model)
host_table.show()
# Run the main Qt loop
sys.exit(app.exec_())
示例10: collapse
# 需要导入模块: from PySide2.QtWidgets import QApplication [as 别名]
# 或者: from PySide2.QtWidgets.QApplication import exec_ [as 别名]
def collapse(self, full_rows: list):
for row in reversed(sorted(full_rows)):
for column in range(self.num_columns):
self[row, column].collapse()
def shift(self, full_rows: list):
for row in reversed(range(min(full_rows))):
for column in range(self.num_columns):
if self[row, column] is not None:
self[row, column].shift(len(full_rows))
def restart(self):
for tile in filter(lambda tl: tl is not None, self):
tile.disappear()
self.clear()
self.update({(row, column): None for row in range(self.num_rows) for column in range(self.num_columns)})
self.score = 0
self.delegate.scored(self.score)
self.spawn()
if __name__ == '__main__':
from PySide2.QtWidgets import QApplication
import sys
import ui
application = QApplication(sys.argv)
qTetris = ui.QTetris()
sys.exit(application.exec_())
示例11: QPoint
# 需要导入模块: from PySide2.QtWidgets import QApplication [as 别名]
# 或者: from PySide2.QtWidgets.QApplication import exec_ [as 别名]
self.setXRotation(self.xRot + 8 * dy)
self.setYRotation(self.yRot + 8 * dx)
elif event.buttons() & Qt.RightButton:
self.setXRotation(self.xRot + 8 * dy)
self.setZRotation(self.zRot + 8 * dx)
self.lastPos = QPoint(event.pos())
if __name__ == '__main__':
app = QApplication(sys.argv)
fmt = QSurfaceFormat()
fmt.setDepthBufferSize(24)
if "--multisample" in QCoreApplication.arguments():
fmt.setSamples(4)
if "--coreprofile" in QCoreApplication.arguments():
fmt.setVersion(3, 2)
fmt.setProfile(QSurfaceFormat.CoreProfile)
QSurfaceFormat.setDefaultFormat(fmt)
mainWindow = Window()
if "--transparent" in QCoreApplication.arguments():
mainWindow.setAttribute(Qt.WA_TranslucentBackground)
mainWindow.setAttribute(Qt.WA_NoSystemBackground, False)
mainWindow.resize(mainWindow.sizeHint())
mainWindow.show()
res = app.exec_()
sys.exit(res)
示例12: _remove_download_requested
# 需要导入模块: from PySide2.QtWidgets import QApplication [as 别名]
# 或者: from PySide2.QtWidgets.QApplication import exec_ [as 别名]
self.statusBar().addWidget(download_widget)
def _remove_download_requested(self):
download_widget = self.sender()
self.statusBar().removeWidget(download_widget)
del download_widget
def _show_find(self):
if self._find_tool_bar is None:
self._find_tool_bar = FindToolBar()
self._find_tool_bar.find.connect(self._tab_widget.find)
self.addToolBar(Qt.BottomToolBarArea, self._find_tool_bar)
else:
self._find_tool_bar.show()
self._find_tool_bar.focus_find()
def write_bookmarks(self):
self._bookmark_widget.write_bookmarks()
if __name__ == '__main__':
app = QApplication(sys.argv)
main_win = create_main_window()
initial_urls = sys.argv[1:]
if not initial_urls:
initial_urls.append('http://qt.io')
for url in initial_urls:
main_win.load_url_in_new_tab(QUrl.fromUserInput(url))
exit_code = app.exec_()
main_win.write_bookmarks()
sys.exit(exit_code)
示例13: syncMenu
# 需要导入模块: from PySide2.QtWidgets import QApplication [as 别名]
# 或者: from PySide2.QtWidgets.QApplication import exec_ [as 别名]
def syncMenu(self):
self.actionPort_Config_Panel.setChecked(not self.dockWidget_PortConfig.isHidden())
self.actionQuick_Send_Panel.setChecked(not self.dockWidget_QuickSend.isHidden())
self.actionSend_Hex_Panel.setChecked(not self.dockWidget_SendHex.isHidden())
def onViewChanged(self):
checked = self._viewGroup.checkedAction()
if checked is None:
self.actionHEX_UPPERCASE.setChecked(True)
self.receiver_thread.setViewMode(VIEWMODE_HEX_UPPERCASE)
else:
if 'Ascii' in checked.text():
self.receiver_thread.setViewMode(VIEWMODE_ASCII)
elif 'lowercase' in checked.text():
self.receiver_thread.setViewMode(VIEWMODE_HEX_LOWERCASE)
elif 'UPPERCASE' in checked.text():
self.receiver_thread.setViewMode(VIEWMODE_HEX_UPPERCASE)
def is_hex(s):
try:
int(s, 16)
return True
except ValueError:
return False
if __name__ == '__main__':
app = QApplication(sys.argv)
frame = MainWindow()
frame.show()
app.exec_()
示例14: QPoint
# 需要导入模块: from PySide2.QtWidgets import QApplication [as 别名]
# 或者: from PySide2.QtWidgets.QApplication import exec_ [as 别名]
self.pixmap = QPixmap.fromImage(image)
self.pixmapOffset = QPoint()
self.lastDragPosition = QPoint()
self.pixmapScale = scaleFactor
self.update()
def zoom(self, zoomFactor):
self.curScale *= zoomFactor
self.update()
self.thread.render(self.centerX, self.centerY, self.curScale,
self.size())
def scroll(self, deltaX, deltaY):
self.centerX += deltaX * self.curScale
self.centerY += deltaY * self.curScale
self.update()
self.thread.render(self.centerX, self.centerY, self.curScale,
self.size())
if __name__ == '__main__':
import sys
app = QApplication(sys.argv)
widget = MandelbrotWidget()
widget.show()
r = app.exec_()
widget.thread.stop()
sys.exit(r)
示例15: main
# 需要导入模块: from PySide2.QtWidgets import QApplication [as 别名]
# 或者: from PySide2.QtWidgets.QApplication import exec_ [as 别名]
def main():
app = QApplication(sys.argv)
w = MainWindow()
w.show()
QMessageBox.information(None, "Info", "Just drag and drop the items.")
sys.exit(app.exec_())