本文整理汇总了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)
示例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([])
示例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)
示例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)
示例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)
示例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()