How to use the qtpy.QtWidgets.QHBoxLayout function in QtPy

To help you get started, we’ve selected a few QtPy examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github rgerum / pylustrator / pylustrator / QtGuiDrag.py View on Github external
def __init__(self, layout, text, multiline=False, horizontal=True):
        QtWidgets.QWidget.__init__(self)
        layout.addWidget(self)
        if horizontal:
            self.layout = QtWidgets.QHBoxLayout(self)
        else:
            self.layout = QtWidgets.QVBoxLayout(self)
        self.label = QtWidgets.QLabel(text)
        self.layout.addWidget(self.label)
        self.layout.setContentsMargins(0, 0, 0, 0)

        self.multiline = multiline
        if multiline:
            self.input1 = QtWidgets.QTextEdit()
            self.input1.textChanged.connect(self.valueChangeEvent)
            self.input1.text = self.input1.toPlainText
        else:
            self.input1 = QtWidgets.QLineEdit()
            self.input1.editingFinished.connect(self.valueChangeEvent)
        self.layout.addWidget(self.input1)
github avalentino / gsdview / gsdview / plugins / positiontracker / coordinateview.py View on Github external
def __init__(self, parent=None, flags=QtCore.Qt.WindowFlags(0), **kwargs):
        super(CoordinateView, self).__init__(parent, flags, **kwargs)

        layout = QtWidgets.QHBoxLayout()

        self.xlabel = QtWidgets.QLabel('x:')
        layout.addWidget(self.xlabel)

        self.xedit = QtWidgets.QLineEdit()
        self.xedit.setMaxLength(6)
        self.xedit.setReadOnly(True)
        layout.addWidget(self.xedit)

        self.ylabel = QtWidgets.QLabel('y:')
        layout.addWidget(self.ylabel)

        self.yedit = QtWidgets.QLineEdit()
        self.yedit.setMaxLength(6)
        self.yedit.setReadOnly(True)
        layout.addWidget(self.yedit)
github napari / napari / napari / _qt / qt_main_window.py View on Github external
def __init__(self, qt_viewer, *, show=True):

        self.qt_viewer = qt_viewer

        self._qt_window = QMainWindow()
        self._qt_window.setUnifiedTitleAndToolBarOnMac(True)
        self._qt_center = QWidget(self._qt_window)

        self._qt_window.setCentralWidget(self._qt_center)
        self._qt_window.setWindowTitle(self.qt_viewer.viewer.title)
        self._qt_center.setLayout(QHBoxLayout())
        self._status_bar = QStatusBar()
        self._qt_window.setStatusBar(self._status_bar)
        self._qt_window.closeEvent = self.closeEvent
        self.close = self._qt_window.close

        self._add_menubar()

        self._add_file_menu()
        self._add_view_menu()
        self._add_window_menu()
        self._add_help_menu()

        self._status_bar.showMessage('Ready')
        self._help = QLabel('')
        self._status_bar.addPermanentWidget(self._help)
github mantidproject / mantid / scripts / Muon / GUI / Common / plotting_widget / plotting_widget_view.py View on Github external
self.plot_selector = QtWidgets.QComboBox(self)
        self.plot_selector.setObjectName("plotSelector")
        self.plot_selector.addItems(["Asymmetry", "Counts"])

        self.plot_button = QtWidgets.QPushButton(self)
        self.plot_button.setObjectName("PlotButton")
        self.plot_button.setText("Plot")

        self.plot_label.setBuddy(self.plot_button)
        self.plot_selector.setSizePolicy(QtWidgets.QSizePolicy.Fixed,
                                         QtWidgets.QSizePolicy.Fixed)
        self.plot_button.setSizePolicy(QtWidgets.QSizePolicy.Fixed,
                                       QtWidgets.QSizePolicy.Fixed)

        self.horizontal_layout = QtWidgets.QHBoxLayout()
        self.horizontal_layout.setObjectName("horizontalLayout")
        self.horizontal_layout.addWidget(self.plot_label)
        self.horizontal_layout.addWidget(self.plot_selector)
        self.horizontal_layout.addStretch(0)
        self.horizontal_layout.addWidget(self.overlay)
        self.overlay.hide()
        self.horizontal_layout.addStretch(0)
        self.horizontal_layout.addWidget(self.keep)
        self.keep.hide()
        self.horizontal_layout.addStretch(0)
        self.horizontal_layout.addWidget(self.raw)
        self.horizontal_layout.addStretch(0)
        self.horizontal_layout.addWidget(self.plot_button)
        self.horizontal_layout.addSpacing(50)

        self.vertical_layout = QtWidgets.QVBoxLayout()
github rgerum / pylustrator / pylustrator / QtGuiDrag.py View on Github external
#self.navi_toolbar = NavigationToolbar(self.canvas, self)
        #self.layout_plot.addWidget(self.navi_toolbar)

        self.fig.canvas.mpl_disconnect(self.fig.canvas.manager.key_press_handler_id)

        self.fig.canvas.mpl_connect('scroll_event', self.scroll_event)
        self.fig.canvas.mpl_connect('key_press_event', self.canvas_key_press)
        self.fig.canvas.mpl_connect('key_release_event', self.canvas_key_release)
        self.control_modifier = False

        self.fig.canvas.mpl_connect('button_press_event', self.button_press_event)
        self.fig.canvas.mpl_connect('motion_notify_event', self.mouse_move_event)
        self.fig.canvas.mpl_connect('button_release_event', self.button_release_event)
        self.drag = None
        
        self.footer_layout = QtWidgets.QHBoxLayout()
        self.layout_plot.addLayout(self.footer_layout)
        
        self.footer_label = QtWidgets.QLabel("")
        self.footer_layout.addWidget(self.footer_label)

        self.footer_layout.addStretch()

        self.footer_label2 = QtWidgets.QLabel("")
        self.footer_layout.addWidget(self.footer_label2)

        #self.layout_plot.addStretch()
        #self.layout_main.addStretch()

        from .QtGui import ColorChooserWidget
        self.colorWidget = ColorChooserWidget(self, self.canvas)
        self.colorWidget.setMaximumWidth(150)
github Dioptas / Dioptas / dioptas / widgets / integration / ControlWidgets.py View on Github external
self.waterfall_btn = FlatButton('Waterfall')
        self.waterfall_reset_btn = FlatButton('Reset')
        self.set_as_background_btn = CheckableFlatButton('Set as Background')

        self._parameter_layout.addWidget(QtWidgets.QLabel('Step'), 0, 2)
        self._parameter_layout.addWidget(LabelAlignRight('Scale:'), 1, 0)
        self._parameter_layout.addWidget(LabelAlignRight('Offset:'), 2, 0)

        self._parameter_layout.addWidget(self.scale_sb, 1, 1)
        self._parameter_layout.addWidget(self.scale_step_txt, 1, 2)
        self._parameter_layout.addWidget(self.offset_sb, 2, 1)
        self._parameter_layout.addWidget(self.offset_step_txt, 2, 2)

        self._parameter_layout.addItem(VerticalSpacerItem(), 3, 0, 1, 3)

        self._waterfall_layout = QtWidgets.QHBoxLayout()
        self._waterfall_layout.addWidget(self.waterfall_btn)
        self._waterfall_layout.addWidget(self.waterfall_separation_txt)
        self._waterfall_layout.addWidget(self.waterfall_reset_btn)
        self._parameter_layout.addLayout(self._waterfall_layout, 4, 0, 1, 3)
        self._parameter_layout.addItem(VerticalSpacerItem(), 5, 0, 1, 3)

        self._background_layout = QtWidgets.QHBoxLayout()
        self._background_layout.addSpacerItem(HorizontalSpacerItem())
        self._background_layout.addWidget(self.set_as_background_btn)
        self._parameter_layout.addLayout(self._background_layout, 6, 0, 1, 3)
        self.parameter_widget.setLayout(self._parameter_layout)

        self._body_layout = QtWidgets.QHBoxLayout()
        self.overlay_tw = ListTableWidget(columns=3)
        self._body_layout.addWidget(self.overlay_tw, 10)
        self._body_layout.addWidget(self.parameter_widget, 0)
github scikit-rf / scikit-rf / qtapps / skrf_qtwidgets / networkPlotWidget.py View on Github external
self.checkBox_useCorrected.setEnabled(False)

        self.comboBox_primarySelector = QtWidgets.QComboBox(self)
        self.comboBox_primarySelector.addItems(("S", "Z", "Y", "A", "Smith Chart"))

        self.comboBox_unitsSelector = QtWidgets.QComboBox(self)
        self.comboBox_unitsSelector.addItems(self.S_UNITS)

        self.comboBox_traceSelector = QtWidgets.QComboBox(self)
        self.set_trace_items()
        self.comboBox_traceSelector.setCurrentIndex(0)

        self.plot_layout = pg.GraphicsLayoutWidget(self)
        self.plot_layout.sceneObj.sigMouseClicked.connect(self.graph_clicked)

        self.horizontalLayout = QtWidgets.QHBoxLayout()
        self.horizontalLayout.addWidget(self.checkBox_useCorrected)
        self.horizontalLayout.addWidget(self.comboBox_primarySelector)
        self.horizontalLayout.addWidget(self.comboBox_unitsSelector)
        self.horizontalLayout.addWidget(self.comboBox_traceSelector)

        self.data_info_label = QtWidgets.QLabel("Click a data point to see info")

        self.verticalLayout = QtWidgets.QVBoxLayout(self)
        self.verticalLayout.setContentsMargins(3, 3, 3, 3)  # normally this will be embedded in another application
        self.verticalLayout.addLayout(self.horizontalLayout)
        self.verticalLayout.addWidget(self.plot_layout)
        self.verticalLayout.addWidget(self.data_info_label)

        self.checkBox_useCorrected.stateChanged.connect(self.set_use_corrected)
        self.comboBox_primarySelector.currentIndexChanged.connect(self.update_plot)
        self.comboBox_unitsSelector.currentIndexChanged.connect(self.update_plot)
github QuTech-Delft / qtt / qtt / param_widget.py View on Github external
super(paramUpdateWidget, self).__init__()

        self.gates=gates
        self.name = name
        self.delta = 10
        self.label=QtWidgets.QLabel(name)
        val=gates.get(name)
        self.value=QtWidgets.QLabel(str(val))
        
        self.plus=QtWidgets.QPushButton('+')
        self.minus=QtWidgets.QPushButton('-')
        vLayout = QtWidgets.QVBoxLayout()
        vLayout.addWidget(self.plus)
        vLayout.addWidget(self.minus)

        hLayout = QtWidgets.QHBoxLayout()
        hLayout.addWidget(self.label)
        hLayout.addWidget(self.value)
        #hLayout.setStyleSheet(" { margin: 0px; padding: 0px; }");
        #hLayout.addWidget(vLayout)
        hLayout.addLayout(vLayout)
        hLayout.setSpacing(1)
        hLayout.setMargin(1)
        #hLayout.setPadding(1)
        
        self.setLayout(hLayout)

        # colors
        self.label.setStyleSheet("QLabel { background-color : #baccba; margin: 2px; padding: 2px; }");
        self.value.setStyleSheet("QLabel { background-color : #cadaca; margin: 2px; padding: 2px; }");
        self.plus.setStyleSheet("QPushButton { margin: 0px; padding: 0px; }");
        self.minus.setStyleSheet("QPushButton { margin: 0px; padding: 0px; }");
github Ulm-IQO / qudi / gui / fitsettings.py View on Github external
# set up window
        self.setModal(False)
        self.setWindowTitle(self.title)

        # variables
        self.all_functions = self.fc.fit_logic.fit_list[self.fc.dimension]
        self.tabs = {}
        self.parameters = {}
        self.parameterUse = {}
        self.currentFits = OrderedDict()
        self.fitWidgets = OrderedDict()
        self.currentFitWidgets = OrderedDict()

        # widgets and layouts
        self._dialogLayout = QtWidgets.QVBoxLayout()
        self._btnLayout = QtWidgets.QHBoxLayout()
        self._tabWidget = QtWidgets.QTabWidget()
        self._firstPage = QtWidgets.QWidget()
        self._firstPageLayout = QtWidgets.QVBoxLayout()
        self._scrollArea = QtWidgets.QScrollArea()
        self._scrollWidget = QtWidgets.QWidget()
        self._scrLayout = QtWidgets.QVBoxLayout()
        self._dbox = QtWidgets.QDialogButtonBox(
            QtWidgets.QDialogButtonBox.Ok
                | QtWidgets.QDialogButtonBox.Apply
                | QtWidgets.QDialogButtonBox.Cancel,
            QtCore.Qt.Horizontal
        )
        self._addFitButton = QtWidgets.QPushButton('Add fit')
        self._saveFitButton = QtWidgets.QPushButton('Save fits')
        self._loadFitButton = QtWidgets.QPushButton('Load fits')
github slaclab / pydm / pydm / widgets / channel_editor.py View on Github external
def setup_ui(self):
        """
        Create the required UI elements for the form.

        Returns
        -------
        None
        """
        self.setWindowTitle("PyDM Channel Editor")
        vlayout = QtWidgets.QVBoxLayout()
        vlayout.setContentsMargins(5, 5, 5, 5)
        vlayout.setSpacing(5)
        self.setLayout(vlayout)

        hlayout = QtWidgets.QHBoxLayout()
        hlayout.setContentsMargins(0, 0, 0, 0)
        hlayout.setSpacing(5)
        vlayout.addLayout(hlayout)

        # Creating the widgets for the String List and
        # buttons to add and remove actions
        self.list_frame = QtWidgets.QFrame(parent=self)
        self.list_frame.setMinimumHeight(300)
        self.list_frame.setMaximumWidth(200)
        self.list_frame.setLineWidth(1)
        self.list_frame.setFrameShadow(QtWidgets.QFrame.Raised)
        self.list_frame.setFrameShape(QtWidgets.QFrame.StyledPanel)
        lf_layout = QtWidgets.QVBoxLayout()
        self.list_frame.setLayout(lf_layout)

        self.lst_channels = QtWidgets.QListWidget()