本文整理汇总了Python中PyQt4.QtSvg方法的典型用法代码示例。如果您正苦于以下问题:Python PyQt4.QtSvg方法的具体用法?Python PyQt4.QtSvg怎么用?Python PyQt4.QtSvg使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4
的用法示例。
在下文中一共展示了PyQt4.QtSvg方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: import_pyqt5
# 需要导入模块: import PyQt4 [as 别名]
# 或者: from PyQt4 import QtSvg [as 别名]
def import_pyqt5():
"""
Import PyQt5
ImportErrors rasied within this function are non-recoverable
"""
from PyQt5 import QtCore, QtSvg, QtWidgets, QtGui, QtPrintSupport
import sip
# Alias PyQt-specific functions for PySide compatibility.
QtCore.Signal = QtCore.pyqtSignal
QtCore.Slot = QtCore.pyqtSlot
# Join QtGui and QtWidgets for Qt4 compatibility.
QtGuiCompat = types.ModuleType('QtGuiCompat')
QtGuiCompat.__dict__.update(QtGui.__dict__)
QtGuiCompat.__dict__.update(QtWidgets.__dict__)
QtGuiCompat.__dict__.update(QtPrintSupport.__dict__)
api = QT_API_PYQT5
return QtCore, QtGuiCompat, QtSvg, api
示例2: new_load_qt
# 需要导入模块: import PyQt4 [as 别名]
# 或者: from PyQt4 import QtSvg [as 别名]
def new_load_qt(api):
"""
Directly import the Qt libraries rather than autodiscovering them
"""
from PyQt4 import QtCore, QtGui, QtSvg
return QtCore, QtGui, QtSvg, 'pyqt'
示例3: has_binding
# 需要导入模块: import PyQt4 [as 别名]
# 或者: from PyQt4 import QtSvg [as 别名]
def has_binding(api):
"""Safely check for PyQt4 or PySide, without importing
submodules
Parameters
----------
api : str [ 'pyqtv1' | 'pyqt' | 'pyside' | 'pyqtdefault']
Which module to check for
Returns
-------
True if the relevant module appears to be importable
"""
# we can't import an incomplete pyside and pyqt4
# this will cause a crash in sip (#1431)
# check for complete presence before importing
module_name = {QT_API_PYSIDE: 'PySide',
QT_API_PYQT: 'PyQt4',
QT_API_PYQTv1: 'PyQt4',
QT_API_PYQT_DEFAULT: 'PyQt4'}
module_name = module_name[api]
import imp
try:
#importing top level PyQt4/PySide module is ok...
mod = __import__(module_name)
#...importing submodules is not
imp.find_module('QtCore', mod.__path__)
imp.find_module('QtGui', mod.__path__)
imp.find_module('QtSvg', mod.__path__)
#we can also safely check PySide version
if api == QT_API_PYSIDE:
return check_version(mod.__version__, '1.0.3')
else:
return True
except ImportError:
return False
示例4: import_pyqt4
# 需要导入模块: import PyQt4 [as 别名]
# 或者: from PyQt4 import QtSvg [as 别名]
def import_pyqt4(version=2):
"""
Import PyQt4
Parameters
----------
version : 1, 2, or None
Which QString/QVariant API to use. Set to None to use the system
default
ImportErrors rasied within this function are non-recoverable
"""
# The new-style string API (version=2) automatically
# converts QStrings to Unicode Python strings. Also, automatically unpacks
# QVariants to their underlying objects.
import sip
if version is not None:
sip.setapi('QString', version)
sip.setapi('QVariant', version)
from PyQt4 import QtGui, QtCore, QtSvg
if not check_version(QtCore.PYQT_VERSION_STR, '4.7'):
raise ImportError("IPython requires PyQt4 >= 4.7, found %s" %
QtCore.PYQT_VERSION_STR)
# Alias PyQt-specific functions for PySide compatibility.
QtCore.Signal = QtCore.pyqtSignal
QtCore.Slot = QtCore.pyqtSlot
# query for the API version (in case version == None)
version = sip.getapi('QString')
api = QT_API_PYQTv1 if version == 1 else QT_API_PYQT
return QtCore, QtGui, QtSvg, api
示例5: import_pyside
# 需要导入模块: import PyQt4 [as 别名]
# 或者: from PyQt4 import QtSvg [as 别名]
def import_pyside():
"""
Import PySide
ImportErrors raised within this function are non-recoverable
"""
from PySide import QtGui, QtCore, QtSvg
return QtCore, QtGui, QtSvg, QT_API_PYSIDE
示例6: has_binding
# 需要导入模块: import PyQt4 [as 别名]
# 或者: from PyQt4 import QtSvg [as 别名]
def has_binding(api):
"""Safely check for PyQt4 or PySide, without importing
submodules
Parameters
----------
api : str [ 'pyqtv1' | 'pyqt' | 'pyside' | 'pyqtdefault']
Which module to check for
Returns
-------
True if the relevant module appears to be importable
"""
# we can't import an incomplete pyside and pyqt4
# this will cause a crash in sip (#1431)
# check for complete presence before importing
module_name = {QT_API_PYSIDE: 'PySide',
QT_API_PYQT: 'PyQt4',
QT_API_PYQTv1: 'PyQt4',
QT_API_PYQT_DEFAULT: 'PyQt4',
QT_API_PYQT5: 'PyQt5',
}
module_name = module_name[api]
import imp
try:
#importing top level PyQt4/PySide module is ok...
mod = __import__(module_name)
#...importing submodules is not
imp.find_module('QtCore', mod.__path__)
imp.find_module('QtGui', mod.__path__)
imp.find_module('QtSvg', mod.__path__)
#we can also safely check PySide version
if api == QT_API_PYSIDE:
return check_version(mod.__version__, '1.0.3')
else:
return True
except ImportError:
return False
示例7: import_pyqt4
# 需要导入模块: import PyQt4 [as 别名]
# 或者: from PyQt4 import QtSvg [as 别名]
def import_pyqt4(version=2):
"""
Import PyQt4
Parameters
----------
version : 1, 2, or None
Which QString/QVariant API to use. Set to None to use the system
default
ImportErrors raised within this function are non-recoverable
"""
# The new-style string API (version=2) automatically
# converts QStrings to Unicode Python strings. Also, automatically unpacks
# QVariants to their underlying objects.
import sip
if version is not None:
sip.setapi('QString', version)
sip.setapi('QVariant', version)
from PyQt4 import QtGui, QtCore, QtSvg
if not check_version(QtCore.PYQT_VERSION_STR, '4.7'):
raise ImportError("IPython requires PyQt4 >= 4.7, found %s" %
QtCore.PYQT_VERSION_STR)
# Alias PyQt-specific functions for PySide compatibility.
QtCore.Signal = QtCore.pyqtSignal
QtCore.Slot = QtCore.pyqtSlot
# query for the API version (in case version == None)
version = sip.getapi('QString')
api = QT_API_PYQTv1 if version == 1 else QT_API_PYQT
return QtCore, QtGui, QtSvg, api
示例8: import_pyqt5
# 需要导入模块: import PyQt4 [as 别名]
# 或者: from PyQt4 import QtSvg [as 别名]
def import_pyqt5():
"""
Import PyQt5
ImportErrors raised within this function are non-recoverable
"""
from PyQt5 import QtGui, QtCore, QtSvg
# Alias PyQt-specific functions for PySide compatibility.
QtCore.Signal = QtCore.pyqtSignal
QtCore.Slot = QtCore.pyqtSlot
return QtCore, QtGui, QtSvg, QT_API_PYQT5
示例9: import_pyside
# 需要导入模块: import PyQt4 [as 别名]
# 或者: from PyQt4 import QtSvg [as 别名]
def import_pyside():
"""
Import PySide
ImportErrors raised within this function are non-recoverable
"""
from PySide import QtGui, QtCore, QtSvg # @UnresolvedImport
return QtCore, QtGui, QtSvg, QT_API_PYSIDE
示例10: has_binding
# 需要导入模块: import PyQt4 [as 别名]
# 或者: from PyQt4 import QtSvg [as 别名]
def has_binding(api):
"""Safely check for PyQt4/5, PySide or PySide2, without importing
submodules
Supports Python <= 3.3
Parameters
----------
api : str [ 'pyqtv1' | 'pyqt' | 'pyqt5' | 'pyside' | 'pyside2' | 'pyqtdefault']
Which module to check for
Returns
-------
True if the relevant module appears to be importable
"""
# we can't import an incomplete pyside and pyqt4
# this will cause a crash in sip (#1431)
# check for complete presence before importing
module_name = api_to_module[api]
import imp
try:
#importing top level PyQt4/PySide module is ok...
mod = __import__(module_name)
#...importing submodules is not
imp.find_module('QtCore', list(mod.__path__))
imp.find_module('QtGui', list(mod.__path__))
imp.find_module('QtSvg', list(mod.__path__))
if api == QT_API_PYQT5 or api == QT_API_PYSIDE2:
# QT5 requires QtWidgets too
imp.find_module('QtWidgets', list(mod.__path__))
#we can also safely check PySide version
if api == QT_API_PYSIDE:
return check_version(mod.__version__, '1.0.3')
else:
return True
except ImportError:
return False
示例11: has_binding_new
# 需要导入模块: import PyQt4 [as 别名]
# 或者: from PyQt4 import QtSvg [as 别名]
def has_binding_new(api):
"""Safely check for PyQt4/5 or PySide, without importing submodules
Supports Python >= 3.4
Parameters
----------
api : str [ 'pyqtv1' | 'pyqt' | 'pyqt5' | 'pyside' | 'pyqtdefault']
Which module to check for
Returns
-------
True if the relevant module appears to be importable
"""
module_name = api_to_module[api]
from importlib.util import find_spec
required = ['QtCore', 'QtGui', 'QtSvg']
if api in (QT_API_PYQT5, QT_API_PYSIDE2):
# QT5 requires QtWidgets too
required.append('QtWidgets')
for submod in required:
try:
spec = find_spec('%s.%s' % (module_name, submod))
except ImportError:
# Package (e.g. PyQt5) not found
return False
else:
if spec is None:
# Submodule (e.g. PyQt5.QtCore) not found
return False
if api == QT_API_PYSIDE:
# We can also safely check PySide version
import PySide
return check_version(PySide.__version__, '1.0.3')
return True
示例12: import_pyqt4
# 需要导入模块: import PyQt4 [as 别名]
# 或者: from PyQt4 import QtSvg [as 别名]
def import_pyqt4(version=2):
"""
Import PyQt4
Parameters
----------
version : 1, 2, or None
Which QString/QVariant API to use. Set to None to use the system
default
ImportErrors rasied within this function are non-recoverable
"""
# The new-style string API (version=2) automatically
# converts QStrings to Unicode Python strings. Also, automatically unpacks
# QVariants to their underlying objects.
import sip
if version is not None:
sip.setapi('QString', version)
sip.setapi('QVariant', version)
from PyQt4 import QtGui, QtCore, QtSvg
if not check_version(QtCore.PYQT_VERSION_STR, '4.7'):
raise ImportError("QtConsole requires PyQt4 >= 4.7, found %s" %
QtCore.PYQT_VERSION_STR)
# Alias PyQt-specific functions for PySide compatibility.
QtCore.Signal = QtCore.pyqtSignal
QtCore.Slot = QtCore.pyqtSlot
# query for the API version (in case version == None)
version = sip.getapi('QString')
api = QT_API_PYQTv1 if version == 1 else QT_API_PYQT
return QtCore, QtGui, QtSvg, api