Python PyQt5.QtGui.QHBoxLayout() Examples
The following are 12 code examples for showing how to use PyQt5.QtGui.QHBoxLayout(). These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example.
You may check out the related API usage on the sidebar.
You may also want to check out all available functions/classes of the module
PyQt5.QtGui
, or try the search function
.
Example 1
Project: Quantdom Author: constverum File: ui.py License: Apache License 2.0 | 6 votes |
def __init__(self, parent=None): super().__init__(parent) self.setTitle('Strategy') self.setAlignment(QtCore.Qt.AlignCenter) self.layout = QtGui.QHBoxLayout(self) self.layout.setContentsMargins(0, 0, 0, 0) self.list = QtGui.QComboBox() self.add_btn = QtGui.QPushButton('+') self.add_btn.clicked.connect(self.add_strategies) self.start_btn = QtGui.QPushButton('Start Backtest') self.start_btn.clicked.connect(self.load_strategy) self.layout.addWidget(self.list, stretch=2) self.layout.addWidget(self.add_btn, stretch=0) self.layout.addWidget(self.start_btn, stretch=0) self.load_strategies_from_settings()
Example 2
Project: Quantdom Author: constverum File: ui.py License: Apache License 2.0 | 6 votes |
def __init__(self, parent=None): super().__init__(parent) self.layout = QtGui.QVBoxLayout(self) self.layout.setContentsMargins(0, 0, 0, 0) self.table_layout = QtGui.QHBoxLayout() self.top_layout = QtGui.QHBoxLayout() self.top_layout.setContentsMargins(0, 10, 0, 0) self.start_optimization_btn = QtGui.QPushButton('Start') self.start_optimization_btn.clicked.connect(self.start_optimization) self.top_layout.addWidget( self.start_optimization_btn, alignment=QtCore.Qt.AlignRight ) self.layout.addLayout(self.top_layout) self.layout.addLayout(self.table_layout)
Example 3
Project: kite Author: pyrocko File: qt_utils.py License: GNU General Public License v3.0 | 5 votes |
def __init__(self, horizontal=True, parent=None, decimals=3, step=.005, slider_exponent=1): QtGui.QWidget.__init__(self, parent) self.vmin = None self.vmax = None self.slider_exponent = slider_exponent self.decimals = decimals self.step = 100 self.valueLen = 2 self.suffix = None self._value = None self.spin = QtGui.QDoubleSpinBox() self.spin.setDecimals(decimals) self.spin.setSingleStep(step) self.spin.valueChanged.connect(self._spin_updated) self.spin.setFrame(False) self.slider = QtGui.QSlider( QtCore.Qt.Orientation(1 if horizontal else 0), self) # 1 = hor. self.slider.setTickPosition( QtGui.QSlider.TicksAbove if horizontal else QtGui.QSlider.TicksLeft) self.slider.setRange(0, 99) self.slider.sliderMoved.connect(self._slider_updated) layout = QtGui.QHBoxLayout() if horizontal else QtGui.QVBoxLayout() self.setLayout(layout) layout.addWidget(self.slider) layout.addWidget(self.spin)
Example 4
Project: grap Author: AirbusCyber File: QtShim.py License: MIT License | 5 votes |
def get_QHBoxLayout(): """QHBoxLayout getter.""" try: import PySide.QtGui as QtGui return QtGui.QHBoxLayout except ImportError: import PyQt5.QtWidgets as QtWidgets return QtWidgets.QHBoxLayout
Example 5
Project: Quantdom Author: constverum File: ui.py License: Apache License 2.0 | 5 votes |
def __init__(self, parent=None): super().__init__(parent) self.layout = QtGui.QVBoxLayout(self) self.layout.setContentsMargins(0, 0, 0, 0) self.toolbar_layout = QtGui.QHBoxLayout() self.toolbar_layout.setContentsMargins(10, 10, 15, 0) self.chart_layout = QtGui.QHBoxLayout() self.init_timeframes_ui() self.init_strategy_ui() self.layout.addLayout(self.toolbar_layout) self.layout.addLayout(self.chart_layout)
Example 6
Project: Quantdom Author: constverum File: ui.py License: Apache License 2.0 | 5 votes |
def init_timeframes_ui(self): self.tf_layout = QtGui.QHBoxLayout() self.tf_layout.setSpacing(0) self.tf_layout.setContentsMargins(0, 12, 0, 0) time_frames = ('1M', '5M', '15M', '30M', '1H', '1D', '1W', 'MN') btn_prefix = 'TF' for tf in time_frames: btn_name = ''.join([btn_prefix, tf]) btn = QtGui.QPushButton(tf) # TODO: btn.setEnabled(False) setattr(self, btn_name, btn) self.tf_layout.addWidget(btn) self.toolbar_layout.addLayout(self.tf_layout)
Example 7
Project: Quantdom Author: constverum File: ui.py License: Apache License 2.0 | 5 votes |
def __init__(self, parent=None): super().__init__(parent) self.layout = QtGui.QHBoxLayout(self) self.layout.setContentsMargins(0, 0, 0, 0)
Example 8
Project: Quantdom Author: constverum File: ui.py License: Apache License 2.0 | 5 votes |
def __init__(self, parent=None): super().__init__(parent) self.layout = QtGui.QHBoxLayout(self) self.layout.setContentsMargins(0, 0, 0, 0)
Example 9
Project: Quantdom Author: constverum File: ui.py License: Apache License 2.0 | 5 votes |
def __init__(self, parent=None): super().__init__(parent) self.layout = QtGui.QHBoxLayout(self) self.layout.setContentsMargins(0, 0, 0, 0) self.table = OptimizatimizedResultsTable() self.table.plot() self.layout.addWidget(self.table)
Example 10
Project: kite Author: pyrocko File: qt_utils.py License: GNU General Public License v3.0 | 4 votes |
def __init__(self, parent=None): """Create a new QRangeSlider instance. :param parent: QWidget parent :return: New QRangeSlider instance. """ super().__init__(parent) self.setupUi(self) self.setMouseTracking(False) # self._splitter.setChildrenCollapsible(False) self._splitter.splitterMoved.connect(self._handleMoveSplitter) # head layout self._head_layout = QtWidgets.QHBoxLayout() self._head_layout.setSpacing(0) # self._head_layout.setMargin(0) self._head.setLayout(self._head_layout) self.head = Head(self._head, main=self) self._head_layout.addWidget(self.head) # handle layout self._handle_layout = QtWidgets.QHBoxLayout() self._handle_layout.setSpacing(0) # self._handle_layout.setMargin(0) self._handle.setLayout(self._handle_layout) self.handle = Handle(self._handle, main=self) self.handle.setTextColor((150, 255, 150)) self._handle_layout.addWidget(self.handle) # tail layout self._tail_layout = QtWidgets.QHBoxLayout() self._tail_layout.setSpacing(0) # self._tail_layout.setMargin(0) self._tail.setLayout(self._tail_layout) self.tail = Tail(self._tail, main=self) self._tail_layout.addWidget(self.tail) self._formatter = None # defaults self.setMin(0) self.setMax(99) self.setStart(0) self.setEnd(99) self.setDrawValues(True)
Example 11
Project: qkit Author: qkitgroup File: plot_view.py License: GNU General Public License v2.0 | 4 votes |
def setupUi(self, Form,ds_type, selector_labels): """Sets up the general window This function coordinates the changing input from the signal slots and updates the attributes that are parsed to the plotting lib functions. update_plots() is either periodically called e.g. by the timer or once on startup. Args: self: Object of the Ui_Form class. Form: PlotWindow object that inherits the used calls here from the underlying QWidget class. ds_type: Integer selector_labels: String list with names of the datasets on all axis Returns: No return variable. The function operates on the given object. """ Form.setObjectName(_fromUtf8("Form")) Form.resize(750, 450) self.gridLayout_Top = QtGui.QGridLayout(Form) self.gridLayout_Top.setContentsMargins(0,0,0,0) self.gridLayout_Top.setObjectName(_fromUtf8("gridLayout_Top")) # we push for a tight layout self.gridLayout_Top.setContentsMargins(0,0,0,0) self.gridLayout_Top.setContentsMargins(QtCore.QMargins(0,0,0,0)) self.gridLayout_Top.setSpacing(0) self.horizontalLayout = QtGui.QHBoxLayout() self.horizontalLayout.setSizeConstraint(QtGui.QLayout.SetMinimumSize) self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout")) self.horizontalLayout.setContentsMargins(0,0,0,0) self.horizontalLayout.setContentsMargins(QtCore.QMargins(0,0,0,0)) self.horizontalLayout.setSpacing(0) self.gridLayout_Top.addLayout(self.horizontalLayout, 0, 0, 1, 1) self.gridLayout = QtGui.QGridLayout() self.gridLayout.setObjectName(_fromUtf8("gridLayout")) self.gridLayout_Top.addLayout(self.gridLayout, 1, 0, 1, 1) Form.setWindowTitle(_translate("Form", "Form", None)) QtCore.QMetaObject.connectSlotsByName(Form) self.selector_labels = selector_labels if ds_type == ds_types['coordinate']: self.setupCoordinate(Form) if ds_type == ds_types['vector']: self.setupVector(Form) if ds_type == ds_types['matrix'] or ds_type == -1: self.setupMatrix(Form) if ds_type == ds_types['box']: self.setupBox(Form) if ds_type == ds_types['txt']: self.setupTxt(Form) if ds_type == ds_types['view']: self.setupView(Form)
Example 12
Project: PyRAT Author: birgander2 File: Viewer.py License: Mozilla Public License 2.0 | 4 votes |
def makeView(self): # self.central = QtGui.QWidget() # self.HLayout = QtGui.QHBoxLayout(self.central) self.central = QtWidgets.QSplitter(self) self.central.setOpaqueResize(False) self.central.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding) self.tree = LayerWidget(self) # self.tree.setFixedWidth(200) # self.tree.setSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Expanding) self.central.addWidget(self.tree) # self.HLayout.addItem(self.spacer) self.frame = QtWidgets.QWidget() # self.frame = DelayedUpdater() self.frame.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding) self.imageLabel = QtWidgets.QLabel(self.frame) self.imageLabel.setBackgroundRole(QtGui.QPalette.Base) self.imageLabel.setStyleSheet("QLabel { background-color: #333 }") self.imageLabel.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding) self.imageLabel.setScaledContents(False) self.imageLabel.setAlignment(QtCore.Qt.AlignCenter) self.imageLabel.resize(self.frame.width(), self.frame.height()) self.central.addWidget(self.frame) self.setCentralWidget(self.central) self.resizeframeevent = self.frame.resizeEvent self.frame.resizeEvent = self.resizeFrameEvent # a bit dirtyt to overload like this... # self.central.move.connect(lambda: self.splitterMoved()) # self.frame = QtGui.QWidget() # self.imageLabel = QtGui.QLabel(self.frame) # self.imageLabel.setBackgroundRole(QtGui.QPalette.Base) # self.imageLabel.setStyleSheet("QLabel { background-color: #333 }") # self.imageLabel.setSizePolicy(QtGui.QSizePolicy.Ignored, QtGui.QSizePolicy.Ignored) # self.imageLabel.setScaledContents(False) # self.imageLabel.resize(self.frame.width(), self.frame.height()) # self.setCentralWidget(self.frame) # def split(self, event): # # QtGui.QWidget.resizeEvent(self.frame, event) # # self.central.update() # self.resizeEvent(event) # # self.central.update() # print("Event", self.frame.width(), self.frame.height())