python类QApplication()的实例源码

GUI.py 文件源码 项目:coliform-project 作者: uprm-research-resto 项目源码 文件源码 阅读 29 收藏 0 点赞 0 评论 0
def startRGBSensorGUI():
    app = QApplication(sys.argv)
    mw = RGBMainWindow()
    # cw = RGBCenterWidget()
    rc = app.exec_()
    del app
    sys.exit(rc)
volume_raycasting_example.py 文件源码 项目:ModernGL-Volume-Raycasting-Example 作者: ulricheck 项目源码 文件源码 阅读 33 收藏 0 点赞 0 评论 0
def main():

    # assumes unsigned byte datatype and volume dimensions of 256x256x225
    volsize = (256, 256, 225)
    volume = load_raw(os.path.join("data", "head256.raw"), volsize)
    tff = load_transferfunction(os.path.join("data", "tff.dat"))

    app = QtWidgets.QApplication([])
    window = QGLControllerWidget(volume, volsize, tff)
    window.move(QtWidgets.QDesktopWidget().rect().center() - window.rect().center())
    window.show()
    app.exec_()
Qt.py 文件源码 项目:NeoAnalysis 作者: neoanalysis 项目源码 文件源码 阅读 29 收藏 0 点赞 0 评论 0
def qWait(msec):
                start = time.time()
                QtGui.QApplication.processEvents()
                while time.time() < start + msec * 0.001:
                    QtGui.QApplication.processEvents()
Qt.py 文件源码 项目:NeoAnalysis 作者: neoanalysis 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def qWait(msec):
                start = time.time()
                QtGui.QApplication.processEvents()
                while time.time() < start + msec * 0.001:
                    QtGui.QApplication.processEvents()
testapp.py 文件源码 项目:incubator-senssoft-userale-pyqt5 作者: apache 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def test_app ():
    app = QApplication(sys.argv)    
    app.setObjectName ("testApplication")
    ex = TestApplication()
    ale = Ale (output="mouse.log", user="testUser", toolname="mousetest", toolversion="0.0.1")
    # install globally
    app.installEventFilter (ale)

    sys.exit (app.exec_())
testdragndrop2.py 文件源码 项目:incubator-senssoft-userale-pyqt5 作者: apache 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def test_drag2 ():
    app = QApplication(sys.argv)
    ex = Example()
    ale = Ale (output="drag2.log", user="testUser", toolname="dragtest", toolversion="0.0.1")
    # install globally
    app.installEventFilter (ale)
    ex.show()
    app.exec_()
testclose.py 文件源码 项目:incubator-senssoft-userale-pyqt5 作者: apache 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def test_close ():

    app = QApplication(sys.argv)
    ex = Example()
    ale = Ale ()
    # install globally
    app.installEventFilter (ale)

    sys.exit(app.exec_())
main_window.py 文件源码 项目:pytc-gui 作者: harmslab 项目源码 文件源码 阅读 32 收藏 0 点赞 0 评论 0
def main():
    """
    Main function, staring GUI.
    """
    version = pkg_resources.require("pytc-gui")[0].version

    try:
        app = QW.QApplication(sys.argv)
        app.setApplicationName("pytc")
        app.setApplicationVersion(version)
        pytc_run = MainWindow(app)
        sys.exit(app.exec_())
    except KeyboardInterrupt:
        sys.exit()
TorrentBro.py 文件源码 项目:TorrentBro 作者: subins2000 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def main():
    app = QApplication(sys.argv)

    qtTranslator = QTranslator()
    qtTranslator.load('torrentbro_' + QLocale.system().name(),
                      QLibraryInfo.location(QLibraryInfo.TranslationsPath))
    app.installTranslator(qtTranslator)

    ex = Home()
    sys.exit(app.exec_())
__init__.py 文件源码 项目:activity-browser 作者: LCA-ActivityBrowser 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def run_activity_browser():
    qapp = QtWidgets.QApplication(sys.argv)
    application = Application()
    application.show()

    def exception_hook(*args):
        print(''.join(traceback.format_exception(*args)))

    sys.excepthook = exception_hook

    sys.exit(qapp.exec_())
__init__.py 文件源码 项目:gui_tool 作者: UAVCAN 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def _process_entry_point(channel, iface_name):
    logger.info('Bus monitor process started with PID %r', os.getpid())
    app = QApplication(sys.argv)    # Inheriting args from the parent process

    def exit_if_should():
        if RUNNING_ON_WINDOWS:
            return False
        else:
            return os.getppid() != PARENT_PID       # Parent is dead

    exit_check_timer = QTimer()
    exit_check_timer.setSingleShot(False)
    exit_check_timer.timeout.connect(exit_if_should)
    exit_check_timer.start(2000)

    def get_frame():
        received, obj = channel.receive_nonblocking()
        if received:
            if obj == IPC_COMMAND_STOP:
                logger.info('Bus monitor process has received a stop request, goodbye')
                app.exit(0)
            else:
                return obj

    win = BusMonitorWindow(get_frame, iface_name)
    win.show()

    logger.info('Bus monitor process %r initialized successfully, now starting the event loop', os.getpid())
    sys.exit(app.exec_())


# TODO: Duplicates PlotterManager; refactor into an abstract process factory
__init__.py 文件源码 项目:gui_tool 作者: UAVCAN 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def _process_entry_point(channel):
    logger.info('Plotter process started with PID %r', os.getpid())
    app = QApplication(sys.argv)    # Inheriting args from the parent process

    def exit_if_should():
        if RUNNING_ON_WINDOWS:
            return False
        else:
            return os.getppid() != PARENT_PID       # Parent is dead

    exit_check_timer = QTimer()
    exit_check_timer.setSingleShot(False)
    exit_check_timer.timeout.connect(exit_if_should)
    exit_check_timer.start(2000)

    def get_transfer():
        received, obj = channel.receive_nonblocking()
        if received:
            if obj == IPC_COMMAND_STOP:
                logger.info('Plotter process has received a stop request, goodbye')
                app.exit(0)
            else:
                return obj

    win = PlotterWindow(get_transfer)
    win.show()

    logger.info('Plotter process %r initialized successfully, now starting the event loop', os.getpid())
    sys.exit(app.exec_())
reorderable_list_model.py 文件源码 项目:PyQt5-reorderable-list-model 作者: d1vanov 项目源码 文件源码 阅读 29 收藏 0 点赞 0 评论 0
def main():
    app = QtWidgets.QApplication(sys.argv)
    form = MainForm()
    form.show()
    app.exec_()
progress.py 文件源码 项目:scm-workbench 作者: barry-scott 项目源码 文件源码 阅读 32 收藏 0 点赞 0 评论 0
def main():
    app = QtWidgets.QApplication( ['fred'] )

    prog = QtWidgets.QProgressBar()
    prog.setMinimum( 0 )
    prog.setMaximum( total )
    prog.setTextVisible( False )
    prog.setMinimumHeight( 50 )

    prog.show()

    layout = QtWidgets.QHBoxLayout( prog )
    label = QtWidgets.QLabel()

    layout.addWidget( label )
    layout.setContentsMargins( 20, 0, 0, 0 )

    def inc():
        print( 'inc' )
        global count
        if count == total:
            timer.stop()

        else:
            count += 1
            prog.setValue( count )

    def setProgresLabel( self ):
        label.setText( '%3d%%' % (100 * count / total) )

    prog.valueChanged.connect( setProgresLabel )

    timer = QtCore.QTimer()
    timer.setInterval( 250 )
    timer.timeout.connect( inc )
    timer.start()

    app.exec_()
wb_app.py 文件源码 项目:scm-workbench 作者: barry-scott 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def event( self, event ):
        self.debugLogApp( 'Wb_App.event() type() %r  %s' %
            (event.type(), qt_event_type_names.get( event.type(), '-unknown-' )) )

        return QtWidgets.QApplication.event( self, event )
runnix.py 文件源码 项目:runnix 作者: TheInitializer 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def tree(self):
        with open(l('tree.txt'), 'r') as tree_file:
                for line in tree_file:
                    self.plainTextEdit.insertPlainText(line)
                    self.plainTextEdit.moveCursor(QtGui.QTextCursor.End)
                    QtWidgets.QApplication.processEvents()
        self.plainTextEdit.appendPlainText("\n\n\n\nNo viruses, malware, trojans or spyware found. Your computer is clean.\n")
web_browser.py 文件源码 项目:PyIntroduction 作者: tody411 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
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???????.
kaptan.py 文件源码 项目:kaptan 作者: KaOSx 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def main():
    app = QApplication(sys.argv)
    app.setApplicationName("Kaptan")
    app.setOrganizationName("Kaptan")
    app.setApplicationVersion("5.0 Beta3")
    #app.setStyleSheet(open(join(dirPath, "data/libkaptan.qss").read())

    locale = QLocale.system().name()
    translator = QTranslator(app)
    translator.load("/usr/share/kaptan/languages/kaptan_{}.qm".format(locale))
    app.installTranslator(translator)

    kaptan = Kaptan()
    kaptan.show()
    app.exec_()
sequana_gui.py 文件源码 项目:sequana 作者: sequana 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def sigint_handler(*args):
    """Handler for the SIGINT signal."""
    sys.stderr.write('\r')
    if QW.QMessageBox.question(None, '', "Are you sure you want to quit?",
                            QW.QMessageBox.Yes | QW.QMessageBox.No,
                            QW.QMessageBox.No) == QW.QMessageBox.Yes:
        QW.QApplication.quit()
test_about.py 文件源码 项目:sequana 作者: sequana 项目源码 文件源码 阅读 54 收藏 0 点赞 0 评论 0
def test_directory_dialog(qtbot):
    #assert qt_api.QApplication.instance() is not None
    widget = about.About()
    widget.show()
    qtbot.addWidget(widget)


问题


面经


文章

微信
公众号

扫码关注公众号