本文整理汇总了Python中PyQt5.Qt.QApplication方法的典型用法代码示例。如果您正苦于以下问题:Python Qt.QApplication方法的具体用法?Python Qt.QApplication怎么用?Python Qt.QApplication使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.Qt
的用法示例。
在下文中一共展示了Qt.QApplication方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from PyQt5 import Qt [as 别名]
# 或者: from PyQt5.Qt import QApplication [as 别名]
def __init__(self):
EClient.__init__(self, wrapper=self)
self.qApp = qt.QApplication.instance() or qt.QApplication(sys.argv)
self.readyTrigger = Trigger()
self._logger = logging.getLogger(__class__.__name__)
示例2: __init__
# 需要导入模块: from PyQt5 import Qt [as 别名]
# 或者: from PyQt5.Qt import QApplication [as 别名]
def __init__(self):
from codec import Codec
from window import Window
from system import System
from datajar import DataJar
from filesystem import FileSystem
try:
manifest = json.load(codecs.open('manifest.json', 'r', 'utf-8'))
except:
manifest = {}
for key in assets.manifest:
if key in manifest:
assets.manifest[key] = manifest[key]
self.app = QApplication(sys.argv)
self.app.setApplicationName(assets.manifest['name'])
self.app.setApplicationVersion(assets.manifest['version'])
assets.sys = System()
assets.codec = Codec()
assets.fs = FileSystem()
assets.dataJar = DataJar()
translator = QTranslator()
if translator.load("zh_CN.qm"):
self.app.installTranslator(translator)
self.window = Window(None, assets.manifest['path'] + 'index.html')
sys.exit(self.app.exec_())
示例3: app_quit
# 需要导入模块: from PyQt5 import Qt [as 别名]
# 或者: from PyQt5.Qt import QApplication [as 别名]
def app_quit(self,x=0):
self.running = False
self.enabled = False
self.start_process(False)
self.write_config(self.config)
Qt.QApplication.quit()
示例4: main
# 需要导入模块: from PyQt5 import Qt [as 别名]
# 或者: from PyQt5.Qt import QApplication [as 别名]
def main():
app = QApplication(sys.argv)
font = app.font()
if sys.platform.startswith("win"):
font.setFamily("Microsoft YaHei")
else:
font.setFamily("Ubuntu")
app.setFont(font)
main_window = MainWindow()
main_window.setWindowTitle("Image Downloader")
main_window.show()
sys.exit(app.exec_())
示例5: main
# 需要导入模块: from PyQt5 import Qt [as 别名]
# 或者: from PyQt5.Qt import QApplication [as 别名]
def main():
parser = argparse.ArgumentParser(
description='Run a single task processor',
formatter_class=argparse.RawTextHelpFormatter)
parser.add_argument(
'--host', '-H', dest='host', type=str, help='connect to host')
parser.add_argument(
'--port', '-p', dest='port', type=int, help='port number')
parser.add_argument(
'--unix_path', '-u', dest='unix_path', type=str,
help='connect to Unix domain socket')
parser.add_argument(
'--loop', '-l', dest='loop', default=0, type=int,
help='0=default 1=asyncio 2=uvloop 3=proactor 4=quamash')
parser.add_argument(
'--func_pickle', '-f', dest='func_pickle', default=1, type=int,
help='0=pickle 1=cloudpickle 2=dill')
parser.add_argument(
'--data_pickle', '-d', dest='data_pickle', default=0, type=int,
help='0=pickle 1=cloudpickle 2=dill')
args = parser.parse_args()
if not args.port and not args.unix_path:
print('distex installed OK')
return
if args.loop == LoopType.default:
loop = util.get_loop()
elif args.loop == LoopType.asyncio:
loop = asyncio.get_event_loop()
elif args.loop == LoopType.uvloop:
import uvloop
loop = uvloop.Loop()
elif args.loop == LoopType.proactor:
loop = asyncio.ProactorEventLoop()
elif args.loop == LoopType.quamash:
import quamash
import PyQt5.Qt as qt
qapp = qt.QApplication([]) # noqa
loop = quamash.QEventLoop()
asyncio.set_event_loop(loop)
processor = Processor( # noqa
args.host, args.port, args.unix_path,
args.func_pickle, args.data_pickle)
loop.run_forever()