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


Python QtWidgets.QMainWindow類代碼示例

本文整理匯總了Python中qtpy.QtWidgets.QMainWindow的典型用法代碼示例。如果您正苦於以下問題:Python QMainWindow類的具體用法?Python QMainWindow怎麽用?Python QMainWindow使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


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

示例1: create_figure_window

def create_figure_window(title=''):
    """Creates a figure in a Qt window. Returns the tuple (window, mplfigure)"""
    win = QMainWindow()
    mplfig = MPLFigure()
    win.setCentralWidget(mplfig.canvas)
    win.setWindowTitle(title)
    return win, mplfig
開發者ID:mabuchilab,項目名稱:Instrumental,代碼行數:7,代碼來源:gui.py

示例2: __init__

    def __init__(self):
        QMainWindow.__init__(self)

        # -- instance attributes --
        self.setWindowTitle("Mantid Workbench")
        self.setObjectName("Mantid Workbench")

        # widgets
        self.messagedisplay = None
        self.ipythonconsole = None
        self.workspacewidget = None
        self.editor = None
        self.algorithm_selector = None
        self.plot_selector = None
        self.widgets = []

        # Widget layout map: required for use in Qt.connection
        self._layout_widget_info = None

        # Menus
        self.file_menu = None
        self.file_menu_actions = None
        self.editor_menu = None
        self.view_menu = None
        self.view_menu_actions = None
        self.interfaces_menu = None

        # Allow splash screen text to be overridden in set_splash
        self.splash = SPLASH

        # Layout
        self.setDockOptions(self.DOCKOPTIONS)

        # Project
        self.project = None
開發者ID:samueljackson92,項目名稱:mantid,代碼行數:35,代碼來源:mainwindow.py

示例3: __init__

    def __init__(self, parent=None):
        QMainWindow.__init__(self,parent)
        self.ui = load_ui(__file__, 'converter.ui', baseinstance=self)
        self.ui.InputVal.setValidator(QDoubleValidator(self.ui.InputVal))
        self.ui.totalFlightPathInput.setValidator(QDoubleValidator(self.ui.totalFlightPathInput))
        self.ui.scatteringAngleInput.setValidator(QDoubleValidator(self.ui.scatteringAngleInput))
        self.ui.convertButton.clicked.connect(self.convert)
        self.ui.helpButton.clicked.connect(self.helpClicked)
        self.ui.inputUnits.currentIndexChanged.connect(self.setInstrumentInputs)
        self.ui.outputUnits.currentIndexChanged.connect(self.setInstrumentInputs)
        self.setInstrumentInputs()

        ##defaults
        self.flightpath = -1.0
        self.Theta = -1.0
        self.output = 0.0

        #help
        self.assistant_process = QtCore.QProcess(self)
        # pylint: disable=protected-access
        import mantid
        self.mantidplot_name='TOF Converter'
        self.collection_file = os.path.join(mantid._bindir, '../docs/qthelp/MantidProject.qhc')
        version = ".".join(mantid.__version__.split(".")[:2])
        self.qt_url = 'qthelp://org.sphinx.mantidproject.' + version + '/doc/interfaces/TOF Converter.html'
        self.external_url = 'http://docs.mantidproject.org/nightly/interfaces/TOF Converter.html'

        try:
            import mantid
            #register startup
            mantid.UsageService.registerFeatureUsage("Interface","TofConverter",False)
        except ImportError:
            pass
開發者ID:samueljackson92,項目名稱:mantid,代碼行數:33,代碼來源:converterGUI.py

示例4: create_window

def create_window():
    # Create app and widgets
    app = QApplication(sys.argv)
    win = QMainWindow()
    main_area = QWidget()
    button_area = QWidget()
    scroll_area = QScrollArea()
    button = QPushButton("Start Video")
    btn_grab = QPushButton("Grab Frame")

    # Create layouts
    vbox = QVBoxLayout()
    hbox = QHBoxLayout()

    # Fill Layouts
    vbox.addWidget(scroll_area)
    vbox.addWidget(button_area)
    hbox.addStretch()
    hbox.addWidget(button)
    hbox.addWidget(btn_grab)

    # Assign layouts to widgets
    main_area.setLayout(vbox)
    button_area.setLayout(hbox)
    scroll_area.setLayout(QVBoxLayout())

    # Attach some child widgets directly
    win.setCentralWidget(main_area)

    return app, win, button, btn_grab, scroll_area
開發者ID:mabuchilab,項目名稱:Instrumental,代碼行數:30,代碼來源:camera_gui.py

示例5: closeEvent

 def closeEvent(self, event):
     """Reimplement Qt method."""
     self.plugin.dockwidget.setWidget(self.plugin)
     self.plugin.dockwidget.setVisible(True)
     self.plugin.undock_action.setDisabled(False)
     self.plugin.switch_to_plugin()
     QMainWindow.closeEvent(self, event)
開發者ID:0xBADCA7,項目名稱:spyder,代碼行數:7,代碼來源:base.py

示例6: __init__

 def __init__(self, *args, **kwargs):
     ui_module = MyWidgetUI
     try: self.ui = ui_module.Ui_Form()  #enable autocomplete
     except: pass
     QMainWindow.__init__(self, *args, **kwargs)
     self.widget = QtWidgetLoader(ui_module=ui_module, parent=self, action_receiver=self)
     self.widget.ui.lineEdit.setText("MyWidget")
     self.show()
開發者ID:madsmpedersen,項目名稱:MMPE,代碼行數:8,代碼來源:UseQtGuiLoader.py

示例7: __init__

    def __init__(self, parent=None):
        self.parent = parent

        QMainWindow.__init__(self, parent=parent)
        self.ui = load_ui('jobStatus.ui', baseinstance=self)

        self.init_table()
        self.launch_table_update_thread()
開發者ID:neutrons,項目名稱:FastGR,代碼行數:8,代碼來源:job_monitor_interface.py

示例8: __init__

    def __init__(self, parent=None):
        self.parent = parent

        QMainWindow.__init__(self, parent=parent)
        self.ui = load_ui('advanced_window.ui', baseinstance=self)

        self.setWindowTitle("Advanced Window for Super User Only !")
        self.init_widgets()
開發者ID:neutrons,項目名稱:FastGR,代碼行數:8,代碼來源:advanced_file_window.py

示例9: __init__

    def __init__(self, main_window=None, key=None):
        self.main_window = main_window
        self.key = key

        QMainWindow.__init__(self, parent=main_window)
        self.ui = load_ui('manual_key_value_input.ui', baseinstance=self)

        self.init_widgets()
開發者ID:neutrons,項目名稱:FastGR,代碼行數:8,代碼來源:align_and_focus_args.py

示例10: __init__

    def __init__(self, canvas, parent=None):
        QMainWindow.__init__(self, parent=parent)
        # attributes
        self._canvas = weakref.proxy(canvas)
        self.setAttribute(Qt.WA_DeleteOnClose, True)
        self.setWindowIcon(QIcon(':/images/MantidIcon.ico'))

        self.close_signal.connect(self._run_close)
        self.setAcceptDrops(True)
開發者ID:mantidproject,項目名稱:mantid,代碼行數:9,代碼來源:figurewindow.py

示例11: __init__

    def __init__(self, parent=None, key=None, data_type='sample'):
        self.parent = parent
        self.key = key
        self.data_type = data_type

        QMainWindow.__init__(self, parent=parent)
        self.ui = load_ui('mass_density.ui', baseinstance=self)
        self.init_widgets()
        self.set_column_index()
開發者ID:neutrons,項目名稱:FastGR,代碼行數:9,代碼來源:mass_density_handler.py

示例12: __init__

    def __init__(self, parent=None, button_name=''):
        QMainWindow.__init__(self, parent)
        self.parent = parent
        self.button_name = button_name

        self.ui = load_ui('helpGui.ui', baseinstance=self)

        self.init_global_gui()
        self.init_table()
開發者ID:neutrons,項目名稱:FastGR,代碼行數:9,代碼來源:help_gui.py

示例13: __init__

 def __init__(self):
     QMainWindow.__init__(self)
     self.mplwidget = MatplotlibWidget(self, title='Example',
                                       xlabel='Linear scale',
                                       ylabel='Log scale',
                                       hold=True, yscale='log')
     self.mplwidget.setFocus()
     self.setCentralWidget(self.mplwidget)
     self.plot(self.mplwidget.axes)
開發者ID:madsmpedersen,項目名稱:MMPE,代碼行數:9,代碼來源:matplotlibwidget.py

示例14: __init__

    def __init__(self, parent=None, json_conflicts={}):
        self.parent = parent
        self.json_conflicts = json_conflicts

        QMainWindow.__init__(self, parent=parent)
        self.ui = load_ui('solve_import_conflicts.ui', baseinstance=self)
        #self.ui = UiMainWindow()
        #self.ui.setupUi(self)

        self.init_widgets()
開發者ID:neutrons,項目名稱:FastGR,代碼行數:10,代碼來源:conflicts_solver.py

示例15: __init__

    def __init__(self, parent=None, text=None, filename=None):
        self.parent = parent

        QMainWindow.__init__(self, parent=parent)
        self.ui = load_ui('preview_ascii.ui', baseinstance=self)

        _title = filename
        self.setWindowTitle(_title)

        self.ui.preview_ascii_text_edit.setText(text)
開發者ID:neutrons,項目名稱:FastGR,代碼行數:10,代碼來源:preview_ascii_window.py


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