本文整理匯總了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
示例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
示例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
示例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
示例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)
示例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()
示例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()
示例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()
示例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()
示例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)
示例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()
示例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()
示例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)
示例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()
示例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)