當前位置: 首頁>>代碼示例>>Python>>正文


Python QtGui.QApplication方法代碼示例

本文整理匯總了Python中PyQt5.QtGui.QApplication方法的典型用法代碼示例。如果您正苦於以下問題:Python QtGui.QApplication方法的具體用法?Python QtGui.QApplication怎麽用?Python QtGui.QApplication使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在PyQt5.QtGui的用法示例。


在下文中一共展示了QtGui.QApplication方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: run_gui

# 需要導入模塊: from PyQt5 import QtGui [as 別名]
# 或者: from PyQt5.QtGui import QApplication [as 別名]
def run_gui(statfile=None):
    # Always start by initializing Qt (only once per application)
    warnings.filterwarnings("ignore")
    app = QtGui.QApplication(sys.argv)
    import suite2p
    s2ppath = os.path.dirname(os.path.realpath(suite2p.__file__))
    icon_path = os.path.join(s2ppath, "logo","logo.png"
    )
    app_icon = QtGui.QIcon()
    app_icon.addFile(icon_path, QtCore.QSize(16, 16))
    app_icon.addFile(icon_path, QtCore.QSize(24, 24))
    app_icon.addFile(icon_path, QtCore.QSize(32, 32))
    app_icon.addFile(icon_path, QtCore.QSize(48, 48))
    app_icon.addFile(icon_path, QtCore.QSize(64, 64))
    app_icon.addFile(icon_path, QtCore.QSize(256, 256))
    app.setWindowIcon(app_icon)
    GUI = MainWindow(statfile=statfile)
    ret = app.exec_()
    # GUI.save_gui_data()
    sys.exit(ret)


# run() 
開發者ID:MouseLand,項目名稱:suite2p,代碼行數:25,代碼來源:gui2p.py

示例2: tabbed_qt4_window

# 需要導入模塊: from PyQt5 import QtGui [as 別名]
# 或者: from PyQt5.QtGui import QApplication [as 別名]
def tabbed_qt4_window(self):
        from PyQt4 import QtGui
        from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg, NavigationToolbar2QT
        # mpl backend can already create instance
        # https://stackoverflow.com/a/40031190
        app = QtGui.QApplication.instance()
        if app is None:
            app = QtGui.QApplication([self.title])
        self.root_window = QtGui.QTabWidget()
        self.root_window.setWindowTitle(self.title)
        for name, fig in self.figures.items():
            tab = QtGui.QWidget(self.root_window)
            tab.canvas = FigureCanvasQTAgg(fig)
            vbox = QtGui.QVBoxLayout(tab)
            vbox.addWidget(tab.canvas)
            toolbar = NavigationToolbar2QT(tab.canvas, tab)
            vbox.addWidget(toolbar)
            tab.setLayout(vbox)
            for axes in fig.get_axes():
                if isinstance(axes, Axes3D):
                    # must explicitly allow mouse dragging for 3D plots
                    axes.mouse_init()
            self.root_window.addTab(tab, name)
        self.root_window.show()
        app.exec_() 
開發者ID:MichaelGrupp,項目名稱:evo,代碼行數:27,代碼來源:plot.py

示例3: tabbed_qt5_window

# 需要導入模塊: from PyQt5 import QtGui [as 別名]
# 或者: from PyQt5.QtGui import QApplication [as 別名]
def tabbed_qt5_window(self):
        from PyQt5 import QtGui, QtWidgets
        from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg, NavigationToolbar2QT
        # mpl backend can already create instance
        # https://stackoverflow.com/a/40031190
        app = QtGui.QGuiApplication.instance()
        if app is None:
            app = QtWidgets.QApplication([self.title])
        self.root_window = QtWidgets.QTabWidget()
        self.root_window.setWindowTitle(self.title)
        for name, fig in self.figures.items():
            tab = QtWidgets.QWidget(self.root_window)
            tab.canvas = FigureCanvasQTAgg(fig)
            vbox = QtWidgets.QVBoxLayout(tab)
            vbox.addWidget(tab.canvas)
            toolbar = NavigationToolbar2QT(tab.canvas, tab)
            vbox.addWidget(toolbar)
            tab.setLayout(vbox)
            for axes in fig.get_axes():
                if isinstance(axes, Axes3D):
                    # must explicitly allow mouse dragging for 3D plots
                    axes.mouse_init()
            self.root_window.addTab(tab, name)
        self.root_window.show()
        app.exec_() 
開發者ID:MichaelGrupp,項目名稱:evo,代碼行數:27,代碼來源:plot.py

示例4: qWait

# 需要導入模塊: from PyQt5 import QtGui [as 別名]
# 或者: from PyQt5.QtGui import QApplication [as 別名]
def qWait(msec):
                start = time.time()
                QtGui.QApplication.processEvents()
                while time.time() < start + msec * 0.001:
                    QtGui.QApplication.processEvents() 
開發者ID:SrikanthVelpuri,項目名稱:tf-pose,代碼行數:7,代碼來源:Qt.py

示例5: mkQApp

# 需要導入模塊: from PyQt5 import QtGui [as 別名]
# 或者: from PyQt5.QtGui import QApplication [as 別名]
def mkQApp():
    global QAPP
    if QtGui.QApplication.instance() is None:
        QAPP = QtGui.QApplication([])
    return QAPP 
開發者ID:SrikanthVelpuri,項目名稱:tf-pose,代碼行數:7,代碼來源:Qt.py

示例6: __init__

# 需要導入模塊: from PyQt5 import QtGui [as 別名]
# 或者: from PyQt5.QtGui import QApplication [as 別名]
def __init__(self, argv=sys.argv):
        freeze_support()
        self._args = self._init_logger()
        self._app = QtGui.QApplication(argv) 
開發者ID:ssepulveda,項目名稱:RTGraph,代碼行數:6,代碼來源:app.py

示例7: get_QApplication

# 需要導入模塊: from PyQt5 import QtGui [as 別名]
# 或者: from PyQt5.QtGui import QApplication [as 別名]
def get_QApplication():
    """QApplication getter."""

    try:
        import PySide.QtGui as QtGui
        return QtGui.QApplication
    except ImportError:
        import PyQt5.QtWidgets as QtWidgets
        return QtWidgets.QApplication 
開發者ID:AirbusCyber,項目名稱:grap,代碼行數:11,代碼來源:QtShim.py

示例8: _move_to_center

# 需要導入模塊: from PyQt5 import QtGui [as 別名]
# 或者: from PyQt5.QtGui import QApplication [as 別名]
def _move_to_center(self):
        """Move the application window in the center of the screen."""
        desktop = QtGui.QApplication.desktop()
        x = (desktop.width() - self.width()) / 2
        y = (desktop.height() - self.height()) / 2
        self.move(x, y) 
開發者ID:constverum,項目名稱:Quantdom,代碼行數:8,代碼來源:app.py

示例9: main

# 需要導入模塊: from PyQt5 import QtGui [as 別名]
# 或者: from PyQt5.QtGui import QApplication [as 別名]
def main(debug=False):
    app = QtGui.QApplication.instance()
    if app is None:
        app = QtGui.QApplication([])
    app.setApplicationName(title)
    app.setApplicationVersion(version)

    window = MainWindow()
    window.show()

    if debug:
        window.main_widget.plot_test_data()

    sys.exit(app.exec_()) 
開發者ID:constverum,項目名稱:Quantdom,代碼行數:16,代碼來源:app.py


注:本文中的PyQt5.QtGui.QApplication方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。