当前位置: 首页>>代码示例>>Python>>正文


Python QtGui.QGuiApplication方法代码示例

本文整理汇总了Python中PyQt5.QtGui.QGuiApplication方法的典型用法代码示例。如果您正苦于以下问题:Python QtGui.QGuiApplication方法的具体用法?Python QtGui.QGuiApplication怎么用?Python QtGui.QGuiApplication使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PyQt5.QtGui的用法示例。


在下文中一共展示了QtGui.QGuiApplication方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: main

# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QGuiApplication [as 别名]
def main():
    app = QGuiApplication(sys.argv)
    
    qmlRegisterType(FigureCanvasQTAggToolbar, "Backend", 1, 0, "FigureToolbar")
    
    imgProvider = MatplotlibIconProvider()
    
    engine = QQmlApplicationEngine(parent=app)
    engine.addImageProvider("mplIcons", imgProvider)
    
    context = engine.rootContext()
    data_model = DataSeriesModel()
    context.setContextProperty("dataModel", data_model)
    mainApp = Form(data=data_model)
    context.setContextProperty("draw_mpl", mainApp)
    
    engine.load(QUrl('main.qml'))
    
    win = engine.rootObjects()[0]
    mainApp.figure = win.findChild(QObject, "figure").getFigure()
    
    rc = app.exec_()
    sys.exit(rc) 
开发者ID:fcollonval,项目名称:matplotlib_qtquick_playground,代码行数:25,代码来源:mpl_qtquick1.py

示例2: setUp

# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QGuiApplication [as 别名]
def setUp(self):
        PillowQtTestCase.setUp(self)
        try:
            if ImageQt.qt_version == '5':
                from PyQt5.QtGui import QGuiApplication
            elif ImageQt.qt_version == '4':
                from PyQt4.QtGui import QGuiApplication
            elif ImageQt.qt_version == 'side':
                from PySide.QtGui import QGuiApplication
            elif ImageQt.qt_version == 'side2':
                from PySide2.QtGui import QGuiApplication
        except ImportError:
            self.skipTest('QGuiApplication not installed')

        self.app = QGuiApplication([]) 
开发者ID:holzschu,项目名称:python3_ios,代码行数:17,代码来源:test_imageqt.py

示例3: main

# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QGuiApplication [as 别名]
def main():
    argv = sys.argv
    
    # Trick to set the style / not found how to do it in pythonic way
    argv.extend(["-style", "universal"])
    app = QGuiApplication(argv)

    qmlRegisterType(FigureCanvasQTAggToolbar, "Backend", 1, 0, "FigureToolbar")    
    imgProvider = MatplotlibIconProvider()
    
    # !! You must specified the QApplication as parent of QQmlApplicationEngine
    # otherwise a segmentation fault is raised when exiting the app
    engine = QQmlApplicationEngine(parent=app)
    engine.addImageProvider("mplIcons", imgProvider)
    
    context = engine.rootContext()
    data_model = DataSeriesModel()
    context.setContextProperty("dataModel", data_model)
    mainApp = Form(data=data_model)
    context.setContextProperty("draw_mpl", mainApp)
    
    engine.load(QUrl('main.qml'))
    
    win = engine.rootObjects()[0]
    mainApp.figure = win.findChild(QObject, "figure").getFigure()
    
    rc = app.exec_()
    # There is some trouble arising when deleting all the objects here
    # but I have not figure out how to solve the error message.
    # It looks like 'app' is destroyed before some QObject
    sys.exit(rc) 
开发者ID:fcollonval,项目名称:matplotlib_qtquick_playground,代码行数:33,代码来源:mpl_qtquick2.py

示例4: main

# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QGuiApplication [as 别名]
def main():
    argv = sys.argv
    
    app = QGuiApplication(argv)
    
    qmlRegisterType(FigureCanvasQTAggToolbar, "Backend", 1, 0, "FigureToolbar")
    
    imgProvider = MatplotlibIconProvider()
    view = QQuickView()
    view.engine().addImageProvider("mplIcons", imgProvider)
    view.setResizeMode(QQuickView.SizeRootObjectToView)
    view.setSource(QUrl('backend_qtquick5/FigureToolbar.qml'))
    
    win = view.rootObject()
    fig = win.findChild(QObject, "figure").getFigure()
    ax = fig.add_subplot(111)
    x = np.linspace(-5, 5)
    ax.plot(x, np.sin(x))
    
    view.show()
    
    rc = app.exec_()
    # There is some trouble arising when deleting all the objects here
    # but I have not figure out how to solve the error message.
    # It looks like 'app' is destroyed before some QObject
    sys.exit(rc) 
开发者ID:fcollonval,项目名称:matplotlib_qtquick_playground,代码行数:28,代码来源:mpl_qquick_toolbar.py

示例5: main

# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QGuiApplication [as 别名]
def main():
    argv = sys.argv
    
    # Trick to set the style / not found how to do it in pythonic way
    argv.extend(["-style", "universal"])
    app = QGuiApplication(argv)
    
    qmlRegisterType(FigureCanvasQTAgg, "Backend", 1, 0, "FigureCanvas")
    
    view = QQuickView()
    view.setResizeMode(QQuickView.SizeRootObjectToView)
    view.setSource(QUrl('backend_qtquick5/Figure.qml'))
    view.show()
    
    win = view.rootObject()
    fig = win.findChild(QObject, "figure").getFigure()
    print(fig)
    ax = fig.add_subplot(111)
    x = np.linspace(-5, 5)
    ax.plot(x, np.sin(x))
    
    rc = app.exec_()
    # There is some trouble arising when deleting all the objects here
    # but I have not figure out how to solve the error message.
    # It looks like 'app' is destroyed before some QObject
    sys.exit(rc) 
开发者ID:fcollonval,项目名称:matplotlib_qtquick_playground,代码行数:28,代码来源:mpl_qquick.py

示例6: main

# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QGuiApplication [as 别名]
def main():
    client_dbus = ClientDBus()
    # FIXME: log service failed to dump log
    client_log.debug('Init client dbus: %s' % client_dbus)

    app = QtGui.QGuiApplication(sys.argv)
    app.exec() 
开发者ID:linuxdeepin,项目名称:deepin-remote-assistance,代码行数:9,代码来源:client_dbus_test.py


注:本文中的PyQt5.QtGui.QGuiApplication方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。