当前位置: 首页>>代码示例>>Python>>正文


Python QtGui.QApplication方法代码示例

本文整理汇总了Python中PyQt4.QtGui.QApplication方法的典型用法代码示例。如果您正苦于以下问题:Python QtGui.QApplication方法的具体用法?Python QtGui.QApplication怎么用?Python QtGui.QApplication使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PyQt4.QtGui的用法示例。


在下文中一共展示了QtGui.QApplication方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: keyReleaseEvent

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QApplication [as 别名]
def keyReleaseEvent(self,e):
        # Ctrl key changes mouse cursor
        if e.key() == QtCore.Qt.Key_Control:
            QtGui.QApplication.restoreOverrideCursor()
        # check for zero to release temporary zero
        # somehow, for the numpad key in some machines, a check on Insert is needed aswell
        elif e.key() == QtCore.Qt.Key_0 or e.key() == QtCore.Qt.Key_Insert:
            self.transpTempZero = False
            self.update()

    #############################
    ## Little helper methods
    #############################

    # Helper method that sets tooltip and statustip
    # Provide an QAction and the tip text
    # This text is appended with a hotkeys and then assigned 
开发者ID:pierluigiferrari,项目名称:fcn8s_tensorflow,代码行数:19,代码来源:cityscapesLabelTool.py

示例2: main

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QApplication [as 别名]
def main():
    # This is a very important solution 
    # for the problem in the IPython console.
    app_main = 0
    # ---------------------------------------------------------------------- #
    app_main = QtGui.QApplication(
        sys.argv, 
        QtCore.Qt.WindowStaysOnTopHint
    )
    app_main.processEvents()
    
    # Show Main Window
    tra_ticket_booker = TraTicketBooker()
    tra_ticket_booker.show()
    
    sys.exit(app_main.exec_())
    tra_ticket_booker.driver.quit() 
开发者ID:gw19,项目名称:TRA-Ticket-Booker,代码行数:19,代码来源:TraTicketBooker.py

示例3: get_code

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QApplication [as 别名]
def get_code(url, size=(640, 480), title="Google authentication"):
    """Open a QT webkit window and return the access code."""
    app = QtGui.QApplication([])
    dialog = QtGui.QDialog()
    dialog.setWindowTitle(title)
    dialog.resize(*size)
    webview = QtWebKit.QWebView()
    webpage = QtWebKit.QWebPage()
    webview.setPage(webpage)           
    webpage.loadFinished.connect(lambda: _on_qt_page_load_finished(dialog, webview))
    webview.setUrl(QtCore.QUrl.fromEncoded(url))
    layout = QtGui.QGridLayout()
    layout.addWidget(webview)
    dialog.setLayout(layout)
    dialog.authorization_code = None
    dialog.show()
    app.exec_()
    return dialog.authorization_code 
开发者ID:tokland,项目名称:shoogle,代码行数:20,代码来源:browser.py

示例4: retranslateUi

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QApplication [as 别名]
def retranslateUi(self, MainWindow):
        MainWindow.setWindowTitle(QtGui.QApplication.translate("MainWindow", "Sparta v0.0001", None, QtGui.QApplication.UnicodeUTF8))
        self.tabWidget_3.setTabText(self.tabWidget_3.indexOf(self.tab_5), QtGui.QApplication.translate("MainWindow", "Services", None, QtGui.QApplication.UnicodeUTF8))
        self.tabWidget_3.setTabText(self.tabWidget_3.indexOf(self.tab_6), QtGui.QApplication.translate("MainWindow", "Information", None, QtGui.QApplication.UnicodeUTF8))
        self.tabWidget_3.setTabText(self.tabWidget_3.indexOf(self.tab_7), QtGui.QApplication.translate("MainWindow", "Notes", None, QtGui.QApplication.UnicodeUTF8))
        self.tabWidget_2.setTabText(self.tabWidget_2.indexOf(self.tab_3), QtGui.QApplication.translate("MainWindow", "Hosts", None, QtGui.QApplication.UnicodeUTF8))
        self.tabWidget_2.setTabText(self.tabWidget_2.indexOf(self.tab_4), QtGui.QApplication.translate("MainWindow", "Services", None, QtGui.QApplication.UnicodeUTF8))
        self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab), QtGui.QApplication.translate("MainWindow", "Scan", None, QtGui.QApplication.UnicodeUTF8))
        self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_2), QtGui.QApplication.translate("MainWindow", "Brute", None, QtGui.QApplication.UnicodeUTF8))
        self.tabWidget_4.setTabText(self.tabWidget_4.indexOf(self.tab_8), QtGui.QApplication.translate("MainWindow", "Log", None, QtGui.QApplication.UnicodeUTF8))
        self.tabWidget_4.setTabText(self.tabWidget_4.indexOf(self.tab_9), QtGui.QApplication.translate("MainWindow", "Terminal", None, QtGui.QApplication.UnicodeUTF8))
        self.tabWidget_4.setTabText(self.tabWidget_4.indexOf(self.tab_10), QtGui.QApplication.translate("MainWindow", "Python", None, QtGui.QApplication.UnicodeUTF8))
        self.menuFile.setTitle(QtGui.QApplication.translate("MainWindow", "File", None, QtGui.QApplication.UnicodeUTF8))
        self.menuEdit.setTitle(QtGui.QApplication.translate("MainWindow", "Edit", None, QtGui.QApplication.UnicodeUTF8))
        self.menuSettings.setTitle(QtGui.QApplication.translate("MainWindow", "Settings", None, QtGui.QApplication.UnicodeUTF8))
        self.menuHelp.setTitle(QtGui.QApplication.translate("MainWindow", "Help", None, QtGui.QApplication.UnicodeUTF8))
        self.actionNew_Project.setText(QtGui.QApplication.translate("MainWindow", "New", None, QtGui.QApplication.UnicodeUTF8))
        self.actionNew_Project.setToolTip(QtGui.QApplication.translate("MainWindow", "Create a new project file", None, QtGui.QApplication.UnicodeUTF8))
        self.actionNew_Project.setShortcut(QtGui.QApplication.translate("MainWindow", "Ctrl+N", None, QtGui.QApplication.UnicodeUTF8))
        self.actionExit.setText(QtGui.QApplication.translate("MainWindow", "Exit", None, QtGui.QApplication.UnicodeUTF8))
        self.actionExit.setToolTip(QtGui.QApplication.translate("MainWindow", "Exit the application", None, QtGui.QApplication.UnicodeUTF8))
        self.actionExit.setShortcut(QtGui.QApplication.translate("MainWindow", "Ctrl+Q", None, QtGui.QApplication.UnicodeUTF8))
        self.actionOpen.setText(QtGui.QApplication.translate("MainWindow", "Open", None, QtGui.QApplication.UnicodeUTF8))
        self.actionOpen.setToolTip(QtGui.QApplication.translate("MainWindow", "Open an existing project file", None, QtGui.QApplication.UnicodeUTF8))
        self.actionOpen.setShortcut(QtGui.QApplication.translate("MainWindow", "Ctrl+O", None, QtGui.QApplication.UnicodeUTF8)) 
开发者ID:SECFORCE,项目名称:sparta,代码行数:27,代码来源:gui.py

示例5: run

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QApplication [as 别名]
def run():
    """
        Main function that executes the app.
    """

    app = QtGui.QApplication(sys.argv)

    # Initialize the database
    createDB()

    # Start the app
    GUI = Window()
    GUI.show()
    sys.exit(app.exec_())

# Run the app 
开发者ID:juliarizza,项目名称:certificate_generator,代码行数:18,代码来源:app.py

示例6: gui_fname

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QApplication [as 别名]
def gui_fname(dir=None):
    """
    Select a file via a dialog and return the file name.
    """
    try:
        from PyQt5.QtWidgets import QApplication, QFileDialog
    except ImportError:
        try:
            from PyQt4.QtGui import QApplication, QFileDialog
        except ImportError:
            from PySide.QtGui import QApplication, QFileDialog

    if dir is None:
        dir = './'

    app = QApplication([dir])
    fname = QFileDialog.getOpenFileName(None, "Select a file...",
                                        dir, filter="All files (*)")

    if isinstance(fname, tuple):
        return fname[0]
    else:
        return str(fname) 
开发者ID:tritemio,项目名称:FRETBursts,代码行数:25,代码来源:gui.py

示例7: mainPyQt4Simple

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QApplication [as 别名]
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用). 
开发者ID:tody411,项目名称:PyIntroduction,代码行数:20,代码来源:web_browser.py

示例8: mainPyQt5

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QApplication [as 别名]
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_()) 
开发者ID:tody411,项目名称:PyIntroduction,代码行数:18,代码来源:web_browser.py

示例9: main

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QApplication [as 别名]
def main():
    try:
        from PyQt4.Qt import PYQT_VERSION_STR
        from nmap import __version__
        from fpdf import __version__
        from requests import __version__
    except ImportError as e:
        from PyQt4.Qt import PYQT_VERSION_STR
        from nmap import __version__
        from fpdf import __version__
        from requests import __version__
        print e
        exit(-1)

    from PyQt4.QtGui import QApplication
    from rexploit.controllers.maincontroller import MainController
    app = QApplication(argv)
    mainController = MainController()
    mainController.start()
    exit(app.exec_()) 
开发者ID:danilabs,项目名称:rexploit,代码行数:22,代码来源:main.py

示例10: ImageView

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QApplication [as 别名]
def ImageView(args):
    print("imageView")
    
    try:
        import PyQt4.QtGui as QtGui
    except ImportError:
        sys.exit("Using --imageViewer requires PyQt4, which is not installed.")
    
    from FlashAir import ImageViewer
    
    app = QtGui.QApplication(sys.argv)
    port=args.card_uri.port    
    if(port == None):
        port = 80
    imageViewer = ImageViewer.ImageViewer(socket.gethostbyname(args.card_uri.hostname), port, args.timeout, args.folder_local, args.folder_remote, args.instant, args.recursive, args.debug_image)
    imageViewer.show()
    sys.exit(app.exec_()) 
开发者ID:C-X1,项目名称:PyFlashAero,代码行数:19,代码来源:PyFlashAero.py

示例11: post_to

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QApplication [as 别名]
def post_to(cls, receiver, func, *args, **kwargs):
        """
        Post a callable to be delivered to a specific
        receiver as a CallbackEvent. 

        It is the responsibility of this receiver to 
        handle the event and choose to call the callback.
        """
        # We can create a weak proxy reference to the
        # callback so that if the object associated with
        # a bound method is deleted, it won't call a dead method
        if not isinstance(func, proxy):
            reference = proxy(func, quiet=True)
        else:
            reference = func

        event = cls(reference, *args, **kwargs)

        # post the event to the given receiver
        QtGui.QApplication.postEvent(receiver, event) 
开发者ID:ActiveState,项目名称:code,代码行数:22,代码来源:recipe-578634.py

示例12: InterIdentify

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QApplication [as 别名]
def InterIdentify(xarr, specarr, slines, sfluxes, ws, mdiff=20, wdiff=20, rstep=1, filename=None,
                  function='poly', order=3, sigma=3, smooth=0, niter=5, res=2, dres=0.1, dc=20, ndstep=20,
                  istart=None, method='Zeropoint', scale='zscale', cmap='gray', contrast=1.0,
                  subback=0, textcolor='green', log=None, verbose=True):

    # Create GUI
    App = QtGui.QApplication(sys.argv)
    aw = InterIdentifyWindow(xarr, specarr, slines, sfluxes, ws, rstep=rstep, mdiff=mdiff, wdiff=wdiff, sigma=sigma, niter=niter,
                             res=res, dres=dres, dc=dc, ndstep=ndstep, istart=istart, method=method, smooth=smooth,subback=subback,
                             cmap=cmap, scale=scale, contrast=contrast, filename=filename, textcolor=textcolor, log=log)
    aw.show()
    # Start application event loop
    exit = App.exec_()
    imsol = aw.main.ImageSolution.copy()

    # Check if GUI was executed succesfully
    if exit != 0:
        raise SpecError(
            'InterIdentify GUI has unexpected exit status ' +
            str(exit))
    del aw
    return imsol 
开发者ID:crawfordsm,项目名称:specidentify,代码行数:24,代码来源:interidentify.py

示例13: main

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QApplication [as 别名]
def main():

    app = QtGui.QApplication(sys.argv)

    main = Main(app)
    main.show()

    sys.exit(app.exec_()) 
开发者ID:goldsborough,项目名称:Writer,代码行数:10,代码来源:writer.py

示例14: main

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QApplication [as 别名]
def main():
    app = QtGui.QApplication(sys.argv)
    sniffer = SnifferUI()
    sniffer.show()
    sys.exit(app.exec_()) 
开发者ID:HatBoy,项目名称:SimpleSniffer,代码行数:7,代码来源:Sniffer.py

示例15: keyPressEvent

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QApplication [as 别名]
def keyPressEvent(self,e):
        # Ctrl key changes mouse cursor
        if e.key() == QtCore.Qt.Key_Control:
            QtGui.QApplication.setOverrideCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor))
        # Backspace deletes last point from polygon
        elif e.key() == QtCore.Qt.Key_Backspace:
            if not self.drawPolyClosed:
                del self.drawPoly[-1]
                self.update()
        # set alpha to temporary zero
        elif e.key() == QtCore.Qt.Key_0:
            self.transpTempZero = True
            self.update()
        elif e.key() == QtCore.Qt.Key_E:
            self.select_next_correction()
        elif e.key() == QtCore.Qt.Key_R:
            self.select_previous_correction()
        elif e.key() == QtCore.Qt.Key_1:
            self.modify_correction_type(CorrectionBox.types.TO_CORRECT)
        elif e.key() == QtCore.Qt.Key_2:
            self.modify_correction_type(CorrectionBox.types.TO_REVIEW)
        elif e.key() == QtCore.Qt.Key_3:
            self.modify_correction_type(CorrectionBox.types.RESOLVED)
        elif e.key() == QtCore.Qt.Key_4:
            self.modify_correction_type(CorrectionBox.types.QUESTION)
        elif e.key() == QtCore.Qt.Key_D and self.config.correctionMode:
            self.delete_selected_annotation()
        elif e.key() == QtCore.Qt.Key_M and self.config.correctionMode:
            self.modify_correction_description()

    # Key released 
开发者ID:pierluigiferrari,项目名称:fcn8s_tensorflow,代码行数:33,代码来源:cityscapesLabelTool.py


注:本文中的PyQt4.QtGui.QApplication方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。