Python PyQt5.QtWidgets.QApplication() Examples
The following are 30
code examples of PyQt5.QtWidgets.QApplication().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
PyQt5.QtWidgets
, or try the search function
.
Example #1
Source File: __init__.py From asyncqt with BSD 2-Clause "Simplified" License | 6 votes |
def __init__(self, app=None, set_running_loop=True): self.__app = app or QApplication.instance() assert self.__app is not None, 'No QApplication has been instantiated' self.__is_running = False self.__debug_enabled = False self.__default_executor = None self.__exception_handler = None self._read_notifiers = {} self._write_notifiers = {} self._timer = _SimpleTimer() self.__call_soon_signaller = signaller = _make_signaller(QtCore, object, tuple) self.__call_soon_signal = signaller.signal signaller.signal.connect(lambda callback, args: self.call_soon(callback, *args)) assert self.__app is not None super().__init__() if set_running_loop: asyncio.events._set_running_loop(self)
Example #2
Source File: native.py From BreezeStyleSheets with MIT License | 6 votes |
def main(): """ Application entry point """ logging.basicConfig(level=logging.DEBUG) # create the application and the main window app = QtWidgets.QApplication(sys.argv) #app.setStyle(QtWidgets.QStyleFactory.create("fusion")) window = QtWidgets.QMainWindow() # setup ui ui = example.Ui_MainWindow() ui.setupUi(window) ui.bt_delay_popup.addActions([ ui.actionAction, ui.actionAction_C ]) ui.bt_instant_popup.addActions([ ui.actionAction, ui.actionAction_C ]) ui.bt_menu_button_popup.addActions([ ui.actionAction, ui.actionAction_C ]) window.setWindowTitle("Native example") # tabify dock widgets to show bug #6 window.tabifyDockWidget(ui.dockWidget1, ui.dockWidget2) # auto quit after 2s when testing on travis-ci if "--travis" in sys.argv: QtCore.QTimer.singleShot(2000, app.exit) # run window.show() app.exec_()
Example #3
Source File: main.py From raspiblitz with MIT License | 6 votes |
def main(): # make sure CTRL+C works signal.signal(signal.SIGINT, signal.SIG_DFL) description = """BlitzTUI - the Touch-User-Interface for the RaspiBlitz project Keep on stacking SATs..! :-D""" parser = argparse.ArgumentParser(description=description, formatter_class=RawTextHelpFormatter) parser.add_argument("-V", "--version", help="print version", action="version", version=__version__) parser.add_argument('-d', '--debug', help="enable debug logging", action="store_true") # parse args args = parser.parse_args() if args.debug: setup_logging(log_level="DEBUG") else: setup_logging() log.info("Starting BlitzTUI v{}".format(__version__)) # initialize app app = QApplication(sys.argv) w = AppWindow() w.show() # run app sys.exit(app.exec_())
Example #4
Source File: test_miscwidgets.py From qutebrowser with GNU General Public License v3.0 | 6 votes |
def mock_clipboard(self, mocker): """Fixture to mock QApplication.clipboard. Return: The mocked QClipboard object. """ mocker.patch.object(QApplication, 'clipboard') clipboard = mock.MagicMock() clipboard.supportsSelection.return_value = True QApplication.clipboard.return_value = clipboard return clipboard
Example #5
Source File: talpa.py From kite with GNU General Public License v3.0 | 6 votes |
def __init__(self, filename=None): QtWidgets.QApplication.__init__(self, ['Talpa']) splash_img = QtGui.QPixmap( get_resource('talpa_splash.png'))\ .scaled(QtCore.QSize(400, 250), QtCore.Qt.KeepAspectRatio) self.splash = QtWidgets.QSplashScreen( splash_img, QtCore.Qt.WindowStaysOnTopHint) self.updateSplashMessage('Talpa') self.splash.show() self.processEvents() self.talpa_win = TalpaMainWindow(filename=filename) self.talpa_win.actionExit.triggered.connect(self.exit) self.aboutToQuit.connect(self.talpa_win.sandbox.worker_thread.quit) self.aboutToQuit.connect(self.talpa_win.sandbox.deleteLater) self.aboutToQuit.connect(self.splash.deleteLater) self.aboutToQuit.connect(self.deleteLater) self.talpa_win.show() self.splash.finish(self.talpa_win) rc = self.exec_() sys.exit(rc)
Example #6
Source File: mainPrgGui.py From BaiduNetDiskAutoTransfer with GNU General Public License v3.0 | 6 votes |
def main(): app = QApplication(sys.argv) autoTransferGui = AutoTransferGUI() sys.exit(app.exec_())
Example #7
Source File: pyweed_launcher.py From pyweed with GNU Lesser General Public License v3.0 | 6 votes |
def launch(): """ Basic startup process. """ from PyQt5 import QtCore, QtWidgets from pyweed.gui.SplashScreenHandler import SplashScreenHandler import pyweed.gui.qrc # NOQA # See https://stackoverflow.com/questions/31952711/ QtCore.QCoreApplication.setAttribute(QtCore.Qt.AA_X11InitThreads) fix_locale() app = QtWidgets.QApplication(sys.argv) splashScreenHandler = SplashScreenHandler() app.processEvents() pyweed = get_pyweed() splashScreenHandler.finish(pyweed.mainWindow) sys.exit(app.exec_())
Example #8
Source File: web_browser.py From PyIntroduction with MIT License | 6 votes |
def mainPyQt4Simple(): # 必要なモジュールのimport from PyQt4.QtCore import QUrl from PyQt4.QtGui import QApplication from PyQt4.QtWebKit import QWebView url = 'https://github.com/tody411/PyIntroduction' app = QApplication(sys.argv) # QWebViewによるWebページ表示 browser = QWebView() browser.load(QUrl(url)) browser.show() sys.exit(app.exec_()) ## PyQt4でのWebブラウザー作成(Youtube用).
Example #9
Source File: head_model_OGL.py From simnibs with GNU General Public License v3.0 | 6 votes |
def get_dAdtField(self, matsimnibs, fn_coil): #Try getting the values for plotting dA/dt if fn_coil.endswith('.nii') or fn_coil.endswith('.nii.gz'): M = numpy.array(matsimnibs) if self.skin_surf is not None: field_skin = coil._get_field(fn_coil, self.skin_surf.nodes, M, get_norm=True)*1e7 if self.gm_surf is not None: field_gm = coil._get_field(fn_coil, self.gm_surf.nodes, M, get_norm=True)*1e7 self.hasField = True if self.skin_surf is not None: self.skin_model_field = self.drawModel('Skin', field_skin) QtWidgets.QApplication.processEvents() if self.gm_surf is not None: self.gm_model_field = self.drawModel('GM', field_gm) QtWidgets.QApplication.processEvents() self.selectRenderSurface(self.currenSurface) self.update() else: return None
Example #10
Source File: head_model_OGL.py From simnibs with GNU General Public License v3.0 | 6 votes |
def loadMesh(self, mesh_fn): print("reading ", mesh_fn) self.skin_surf = 'Loading' self.gm_surf = 'Loading' self.mesh_fn = mesh_fn self.loadStage.emit(0) QtWidgets.QApplication.processEvents() mesh_struct = mesh_io.read_msh(mesh_fn) self.loadStage.emit(1) QtWidgets.QApplication.processEvents() self.skin_surf = surface.Surface(mesh_struct, [5,1005]) self.loadStage.emit(2) QtWidgets.QApplication.processEvents() self.gm_surf = surface.Surface(mesh_struct, [2,1002]) self.loadStage.emit(3) QtWidgets.QApplication.processEvents() self.skin_surf.mesh_name = mesh_fn
Example #11
Source File: main_gui.py From simnibs with GNU General Public License v3.0 | 6 votes |
def start_gui(args): app = QtWidgets.QApplication(args) #app.setAttribute(QtCore.Qt.AA_UseDesktopOpenGL) #app.setAttribute(QtCore.Qt.AA_UseSoftwareOpenGL) #app.setAttribute(QtCore.Qt.AA_UseOpenGLES) sys.excepthook = except_hook ex = TDCS_GUI() ex.show() if len(args) > 1: if args[1].endswith(".mat"): ex.openSimnibsFile(args[1]) elif args[1].endswith(".msh"): ex.loadHeadModel(args[1]) else: raise IOError('simnibs_gui can only load .mat and .msh files') sys.exit(app.exec_())
Example #12
Source File: Qt.py From pipeline with MIT License | 6 votes |
def convert(lines): """Convert compiled .ui file from PySide2 to Qt.py Arguments: lines (list): Each line of of .ui file Usage: >> with open("myui.py") as f: .. lines = convert(f.readlines()) """ def parse(line): line = line.replace("from PySide2 import", "from Qt import") line = line.replace("QtWidgets.QApplication.translate", "Qt.QtCompat.translate") return line parsed = list() for line in lines: line = parse(line) parsed.append(line) return parsed
Example #13
Source File: runcat.py From Tools with MIT License | 6 votes |
def runcatCPU(): app = QApplication(sys.argv) # 最后一个可视的窗口退出时程序不退出 app.setQuitOnLastWindowClosed(False) icon = QSystemTrayIcon() icon.setIcon(QIcon('icons/0.png')) icon.setVisible(True) cpu_percent = psutil.cpu_percent(interval=1) / 100 cpu_percent_update_fps = 20 fps_count = 0 while True: fps_count += 1 if fps_count > cpu_percent_update_fps: cpu_percent = psutil.cpu_percent(interval=1) / 100 fps_count = 0 # 开口向上的抛物线, 左边递减 time_interval = (cpu_percent * cpu_percent - 2 * cpu_percent + 2) / 20 for i in range(5): icon.setIcon(QIcon('icons/%d.png' % i)) icon.setToolTip('cpu: %.2f' % cpu_percent) time.sleep(time_interval) app.exec_()
Example #14
Source File: runcat.py From Tools with MIT License | 6 votes |
def runcatMemory(): app = QApplication(sys.argv) # 最后一个可视的窗口退出时程序不退出 app.setQuitOnLastWindowClosed(False) icon = QSystemTrayIcon() icon.setIcon(QIcon('icons/0.png')) icon.setVisible(True) memory_percent = psutil.virtual_memory().percent / 100 memory_percent_update_fps = 20 fps_count = 0 while True: fps_count += 1 if fps_count > memory_percent_update_fps: memory_percent = psutil.virtual_memory().percent / 100 fps_count = 0 # 开口向上的抛物线, 左边递减 time_interval = (memory_percent * memory_percent - 2 * memory_percent + 2) / 20 for i in range(5): icon.setIcon(QIcon('icons/%d.png' % i)) icon.setToolTip('memory: %.2f' % memory_percent) time.sleep(time_interval) app.exec_()
Example #15
Source File: part-4.py From Writer-Tutorial with MIT License | 5 votes |
def main(): app = QtWidgets.QApplication(sys.argv) main = Main() main.show() sys.exit(app.exec_())
Example #16
Source File: web_browser.py From PyIntroduction with MIT License | 5 votes |
def mainPyQt4Youtube(): # 必要なモジュールのimport from PyQt4.QtCore import QUrl from PyQt4.QtGui import QApplication from PyQt4.QtWebKit import QWebView, QWebSettings from PyQt4.QtNetwork import QNetworkProxyFactory url = 'https://www.youtube.com/?hl=ja&gl=JP' app = QApplication(sys.argv) # Youtube動画を読み込むための設定 QNetworkProxyFactory.setUseSystemConfiguration(True) QWebSettings.globalSettings().setAttribute(QWebSettings.PluginsEnabled, True) QWebSettings.globalSettings().setAttribute(QWebSettings.DnsPrefetchEnabled, True) QWebSettings.globalSettings().setAttribute(QWebSettings.JavascriptEnabled, True) QWebSettings.globalSettings().setAttribute(QWebSettings.OfflineStorageDatabaseEnabled, True) QWebSettings.globalSettings().setAttribute(QWebSettings.AutoLoadImages, True) QWebSettings.globalSettings().setAttribute(QWebSettings.LocalStorageEnabled, True) QWebSettings.globalSettings().setAttribute(QWebSettings.PrivateBrowsingEnabled, True) QWebSettings.globalSettings().setAttribute(QWebSettings.DeveloperExtrasEnabled, True) # QWebViewによるWebページ表示 browser = QWebView() browser.load(QUrl(url)) browser.setEnabled(True) browser.show() sys.exit(app.exec_()) ## PyQt5でのWebブラウザー作成.
Example #17
Source File: uamodeler.py From opcua-modeler with GNU General Public License v3.0 | 5 votes |
def main(): app = QApplication(sys.argv) modeler = UaModeler() handler = QtHandler(modeler.ui.logTextEdit) logging.getLogger().addHandler(handler) logging.getLogger("uamodeler").setLevel(logging.INFO) logging.getLogger("uawidgets").setLevel(logging.INFO) #logging.getLogger("opcua").setLevel(logging.INFO) # to enable logging of ua server modeler.show() sys.exit(app.exec_())
Example #18
Source File: web_browser.py From PyIntroduction with MIT License | 5 votes |
def mainPyQt5(): # 必要なモジュールのimport from PyQt5.QtWidgets import QApplication from PyQt5.QtCore import QUrl from PyQt5.QtWebEngineWidgets import QWebEngineView url = 'https://github.com/tody411/PyIntroduction' app = QApplication(sys.argv) # QWebEngineViewによるWebページ表示 browser = QWebEngineView() browser.load(QUrl(url)) browser.show() sys.exit(app.exec_())
Example #19
Source File: __main__.py From scudcloud with MIT License | 5 votes |
def exit(*args): if win is not None: win.exit() else: QtGui.QApplication.quit()
Example #20
Source File: gui_process.py From attack_monitor with GNU General Public License v3.0 | 5 votes |
def run(self): # APP self.APP = QtWidgets.QApplication(sys.argv) self.APP.setQuitOnLastWindowClosed(False) self.gui_instance = gui_code.GUI(self.APP, self.SHOW_MQ, self.TRAY_MQ, self.ALARM_MQ, self.MALWARE_MQ, self.EXCEPTION_RULES) self.gui_instance.initialize_system_tray() self.gui_instance.show_window() self.gui_instance.start_exception_worker() self.gui_instance.start_tray_worker() # INFINITE LOOP self.APP.exec_()
Example #21
Source File: PyQt5.py From fbs with GNU General Public License v3.0 | 5 votes |
def _qt_binding(self): return _QtBinding(QApplication, QIcon, QAbstractSocket)
Example #22
Source File: example_pyqt5.py From PyQt5_stylesheets with Apache License 2.0 | 5 votes |
def main(): """ Application entry point """ logging.basicConfig(level=logging.DEBUG) # create the application and the main window app = QtWidgets.QApplication(sys.argv) window = QtWidgets.QMainWindow() # setup ui ui = example_ui.Ui_MainWindow() ui.setupUi(window) ui.bt_delay_popup.addActions([ ui.actionAction, ui.actionAction_C ]) ui.bt_instant_popup.addActions([ ui.actionAction, ui.actionAction_C ]) ui.bt_menu_button_popup.addActions([ ui.actionAction, ui.actionAction_C ]) window.setWindowTitle("QDarkStyle example") # tabify dock widgets to show bug #6 window.tabifyDockWidget(ui.dockWidget1, ui.dockWidget2) # setup stylesheet app.setStyleSheet(PyQt5_stylesheets.load_stylesheet_pyqt5(style="style_black")) # auto quit after 2s when testing on travis-ci if "--travis" in sys.argv: QtCore.QTimer.singleShot(2000, app.exit) # run window.show() app.exec_()
Example #23
Source File: gui.py From dottorrent-gui with GNU General Public License v3.0 | 5 votes |
def main(): app = QtWidgets.QApplication(sys.argv) MainWindow = QtWidgets.QMainWindow() ui = DottorrentGUI() ui.setupUi(MainWindow) MainWindow.setWindowTitle(PROGRAM_NAME_VERSION) ui.loadSettings() ui.clipboard = app.clipboard app.aboutToQuit.connect(lambda: ui.saveSettings()) MainWindow.show() sys.exit(app.exec_())
Example #24
Source File: part-3.py From Writer-Tutorial with MIT License | 5 votes |
def main(): app = QtWidgets.QApplication(sys.argv) main = Main() main.show() sys.exit(app.exec_())
Example #25
Source File: part-2.py From Writer-Tutorial with MIT License | 5 votes |
def main(): app = QtWidgets.QApplication(sys.argv) main = Main() main.show() sys.exit(app.exec_())
Example #26
Source File: part-1.py From Writer-Tutorial with MIT License | 5 votes |
def main(): app = QtWidgets.QApplication(sys.argv) main = Main() main.show() sys.exit(app.exec_())
Example #27
Source File: main.py From QCustomPlot-PyQt5 with MIT License | 5 votes |
def main(): app = QApplication(sys.argv) # First argument can be a number that specifies loaded example w = mainwindow.MainWindow(sys.argv) w.show() return app.exec_()
Example #28
Source File: main.py From csb with GNU Affero General Public License v3.0 | 5 votes |
def start(): global c app = QtWidgets.QApplication(sys.argv) c = config() c.show() sys.exit(app.exec_())
Example #29
Source File: XPyFEM.py From PyFEM with GNU General Public License v3.0 | 5 votes |
def main(): app = QApplication(sys.argv) ex = XPyFEM() sys.exit(app.exec_())
Example #30
Source File: qiew.py From qiew with GNU General Public License v2.0 | 5 votes |
def main(): if len(sys.argv) <= 1: print('usage: qiew.py <file>') sys.exit() app = QtWidgets.QApplication(sys.argv) filename = sys.argv[1] source = FileDataModel(filename) qiew = Qiew(source, 'qiew - {0}'.format(filename)) qiew.showMaximized() sys.exit(app.exec_())