Python PyQt5.QtGui.QVBoxLayout() Examples
The following are 18
code examples of PyQt5.QtGui.QVBoxLayout().
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 also want to check out all available functions/classes of the module
PyQt5.QtGui
, or try the search function
.
Example #1
Source File: ui.py From Quantdom with 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 #2
Source File: plot.py From evo_slam with GNU General Public License v3.0 | 6 votes |
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_()
Example #3
Source File: plot.py From evo_slam with GNU General Public License v3.0 | 6 votes |
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_()
Example #4
Source File: plot.py From evo with GNU General Public License v3.0 | 6 votes |
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_()
Example #5
Source File: plot.py From evo with GNU General Public License v3.0 | 6 votes |
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_()
Example #6
Source File: charts.py From Quantdom with Apache License 2.0 | 6 votes |
def __init__(self): super().__init__() self.xaxis = DateAxis(orientation='bottom') self.xaxis.setStyle(tickTextOffset=7, textFillLimits=[(0, 0.80)]) self.yaxis = PriceAxis() self.layout = QtGui.QVBoxLayout(self) self.layout.setContentsMargins(0, 0, 0, 0) self.chart = pg.PlotWidget( axisItems={'bottom': self.xaxis, 'right': self.yaxis}, enableMenu=False, ) self.chart.setFrameStyle(QtGui.QFrame.StyledPanel | QtGui.QFrame.Plain) self.chart.getPlotItem().setContentsMargins(*CHART_MARGINS) self.chart.showGrid(x=True, y=True) self.chart.hideAxis('left') self.chart.showAxis('right') self.chart.setCursor(QtCore.Qt.BlankCursor) self.chart.sigXRangeChanged.connect(self._update_yrange_limits) self.layout.addWidget(self.chart)
Example #7
Source File: charts.py From Quantdom with Apache License 2.0 | 6 votes |
def __init__(self): super().__init__() self.signals_visible = False self.style = ChartType.CANDLESTICK self.indicators = [] self.xaxis = DateAxis(orientation='bottom') self.xaxis.setStyle( tickTextOffset=7, textFillLimits=[(0, 0.80)], showValues=False ) self.xaxis_ind = DateAxis(orientation='bottom') self.xaxis_ind.setStyle(tickTextOffset=7, textFillLimits=[(0, 0.80)]) self.layout = QtGui.QVBoxLayout(self) self.layout.setContentsMargins(0, 0, 0, 0) self.splitter = QtGui.QSplitter(QtCore.Qt.Vertical) self.splitter.setHandleWidth(4) self.layout.addWidget(self.splitter)
Example #8
Source File: ui.py From Quantdom with Apache License 2.0 | 6 votes |
def init_external_tab_ui(self): """External data.""" self.external_tab = QtGui.QWidget() self.external_tab.setEnabled(False) self.external_layout = QtGui.QVBoxLayout(self.external_tab) self.import_data_name = QtGui.QLabel('Import External Data') self.import_data_label = QtGui.QLabel('...') self.import_data_btn = QtGui.QPushButton('Import') self.import_data_btn.clicked.connect(self.open_file) self.external_layout.addWidget( self.import_data_name, 0, QtCore.Qt.AlignCenter ) self.external_layout.addWidget( self.import_data_label, 0, QtCore.Qt.AlignCenter ) self.external_layout.addWidget( self.import_data_btn, 0, QtCore.Qt.AlignCenter ) self.select_source.addTab(self.external_tab, 'Custom data')
Example #9
Source File: plot_view.py From qkit with GNU General Public License v2.0 | 6 votes |
def _addIndicatorLabels(self,Form,sizePolicy,indicators=[]): self.IndicatorLayout = QtGui.QVBoxLayout() self.IndicatorLayout.setSizeConstraint(QtGui.QLayout.SetMinimumSize) self.IndicatorLayout.setObjectName(_fromUtf8("horizontalLayout")) self.IndicatorLayout.setContentsMargins(0,0,0,0) self.IndicatorLayout.setContentsMargins(QtCore.QMargins(0,0,0,0)) self.IndicatorLayout.setSpacing(3) for indicator in indicators: setattr(self,indicator,QtGui.QLabel(Form)) temp_indicator = getattr(self,indicator) temp_indicator.setSizePolicy(sizePolicy) temp_indicator.setObjectName(_fromUtf8(indicator)) self.IndicatorLayout.addWidget(temp_indicator) self.horizontalLayout.addLayout(self.IndicatorLayout,stretch = -10)
Example #10
Source File: ui.py From Quantdom with 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 #11
Source File: tab_covariance.py From kite with GNU General Public License v3.0 | 5 votes |
def __init__(self, parent_plot): QtGui.QWidget.__init__(self) self.parent_plot = parent_plot self.model = parent_plot.model self.plot = pg.PlotWidget(background='default') self.plot.showGrid(True, True, alpha=.5) self.plot.setMenuEnabled(True) self.plot.enableAutoRange() self.layout = QtGui.QVBoxLayout(self) self.layout.addWidget(self.plot)
Example #12
Source File: plot_view.py From qkit with GNU General Public License v2.0 | 5 votes |
def _addTraceSelectorIndicator(self,Form,sizePolicy,TraceSelector = "", TraceIndicator="", prefix = "Trace: "): self.TraceSelIndLayout = QtGui.QVBoxLayout() self.TraceSelIndLayout.setSizeConstraint(QtGui.QLayout.SetMinimumSize) self.TraceSelIndLayout.setObjectName(_fromUtf8("TraceSelIndLayout")) self.TraceSelIndLayout.setContentsMargins(0,0,0,0) self.TraceSelIndLayout.setContentsMargins(QtCore.QMargins(0,0,0,0)) self.TraceSelIndLayout.setSpacing(1) setattr(self,TraceSelector,QtGui.QSpinBox(Form)) temp_SelInd = getattr(self,TraceSelector) temp_SelInd.setSizePolicy(sizePolicy) temp_SelInd.setSuffix(_fromUtf8("")) temp_SelInd.setMinimum(-99999) temp_SelInd.setMaximum(99999) temp_SelInd.setProperty("value", -1) temp_SelInd.setObjectName(_fromUtf8(TraceSelector)) temp_SelInd.setPrefix(_translate("Form", prefix , None)) self.TraceSelIndLayout.addWidget(temp_SelInd) setattr(self,TraceIndicator,QtGui.QLineEdit(Form)) temp_SelInd = getattr(self,TraceIndicator) temp_SelInd.setSizePolicy(sizePolicy) temp_SelInd.setReadOnly(False) temp_SelInd.setObjectName(_fromUtf8("TraceValue")) self.TraceSelIndLayout.addWidget(temp_SelInd) self.horizontalLayout.addLayout(self.TraceSelIndLayout,stretch = -10)
Example #13
Source File: gui.py From soapy with GNU General Public License v3.0 | 5 votes |
def __init__(self, nAxes, parent = None): QtGui.QWidget.__init__(self, parent) self.canvas = OverlapCanvas(nAxes) self.vbl = QtGui.QVBoxLayout() self.vbl.addWidget(self.canvas) self.setLayout(self.vbl)
Example #14
Source File: gui.py From soapy with GNU General Public License v3.0 | 5 votes |
def __init__(self, parent = None): QtGui.QWidget.__init__(self, parent) self.canvas = PlotCanvas() self.vbl = QtGui.QVBoxLayout() self.vbl.addWidget(self.canvas) self.setLayout(self.vbl)
Example #15
Source File: QtShim.py From grap with MIT License | 5 votes |
def get_QVBoxLayout(): """QVBoxLayout getter.""" try: import PySide.QtGui as QtGui return QtGui.QVBoxLayout except ImportError: import PyQt5.QtWidgets as QtWidgets return QtWidgets.QVBoxLayout
Example #16
Source File: qt_utils.py From kite with 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 #17
Source File: plot_view.py From qkit with GNU General Public License v2.0 | 4 votes |
def setupBox(self,Form): """Set up slots for value_box. The data can be plotted color coded as a 2d plot at a user selected value of either the x_, y_ or z_axis or as a 1d plot at a user selected value of the x_ and y_axis. Args: self: Object of the Ui_Form class. Form: PlotWindow object that inherits the used calls here from the underlying QWidget class. Returns: No return variable. The function operates on the given object. """ self.PlotTypeSelector = QtGui.QComboBox(Form) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Minimum) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.PlotTypeSelector.sizePolicy().hasHeightForWidth()) self.PlotTypeSelector.setSizePolicy(sizePolicy) self.PlotTypeSelector.setObjectName(_fromUtf8("PlotTypeSelector")) self.PlotTypeSelector.addItem(_fromUtf8("")) self.PlotTypeSelector.addItem(_fromUtf8("")) self.PlotTypeSelector.addItem(_fromUtf8("")) self.PlotTypeSelector.addItem(_fromUtf8("")) #self.horizontalLayout.addWidget(self.PlotTypeSelector) self.PlotTypeSelector.setItemText(0, _translate("Form", "Select X", None)) self.PlotTypeSelector.setItemText(1, _translate("Form", "Select Y", None)) self.PlotTypeSelector.setItemText(2, _translate("Form", "Select Z", None)) self.PlotTypeSelector.setItemText(3, _translate("Form", "Line Plot", None)) self.PlotTypeLayout = QtGui.QVBoxLayout() self.PlotTypeLayout.addWidget(self.PlotTypeSelector) # add a empty label to move the PlotTypeSelector to the top emptyL = QtGui.QLabel(Form) self.PlotTypeLayout.addWidget(emptyL) self.horizontalLayout.addLayout(self.PlotTypeLayout,stretch = -10) self._addTraceSelectorIndicator(Form,sizePolicy,TraceSelector = "TraceXSelector", TraceIndicator="TraceXValue", prefix = self.selector_labels[0]+': ') self._addTraceSelectorIndicator(Form,sizePolicy,TraceSelector = "TraceYSelector", TraceIndicator="TraceYValue", prefix = self.selector_labels[1]+': ') self._addTraceSelectorIndicator(Form,sizePolicy,TraceSelector = "TraceZSelector", TraceIndicator="TraceZValue", prefix = self.selector_labels[2]+': ') spacerItem = QtGui.QSpacerItem(40, 1, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout.addItem(spacerItem) self._addIndicatorLabels(Form,sizePolicy,indicators=["PointX","PointY","PointZ"])
Example #18
Source File: plot_view.py From qkit with GNU General Public License v2.0 | 4 votes |
def setupMatrix(self,Form): """Set up slots for value_matrix. The data can be plotted color coded as a 2d plot, as a 1d plot at a user selected value of the x_axis or the numerical values can be displayed in a table. Args: self: Object of the Ui_Form class. Form: PlotWindow object that inherits the used calls here from the underlying QWidget class. Returns: No return variable. The function operates on the given object. """ self.PlotTypeSelector = QtGui.QComboBox(Form) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Minimum) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.PlotTypeSelector.sizePolicy().hasHeightForWidth()) self.PlotTypeSelector.setSizePolicy(sizePolicy) self.PlotTypeSelector.setObjectName(_fromUtf8("PlotTypeSelector")) self.PlotTypeSelector.addItem(_fromUtf8("")) self.PlotTypeSelector.addItem(_fromUtf8("")) self.PlotTypeSelector.addItem(_fromUtf8("")) self.PlotTypeSelector.addItem(_fromUtf8("")) self.PlotTypeSelector.setItemText(0, _translate("Form", "Color Plot", None)) self.PlotTypeSelector.setItemText(1, _translate("Form", "Line Plot X", None)) self.PlotTypeSelector.setItemText(2, _translate("Form", "Line Plot Y", None)) self.PlotTypeSelector.setItemText(3, _translate("Form", "Table", None)) self.PlotTypeLayout = QtGui.QVBoxLayout() self.PlotTypeLayout.addWidget(self.PlotTypeSelector) # add a empty label to move the PlotTypeSelector to the top emptyL = QtGui.QLabel(Form) self.PlotTypeLayout.addWidget(emptyL) self.horizontalLayout.addLayout(self.PlotTypeLayout,stretch = -10) self._addTraceSelectorIndicator(Form,sizePolicy,TraceSelector = "TraceXSelector", TraceIndicator="TraceXValue", prefix = self.selector_labels[0]+': ') self._addTraceSelectorIndicator(Form,sizePolicy,TraceSelector = "TraceYSelector", TraceIndicator="TraceYValue", prefix = self.selector_labels[1]+': ') #The indicators should be located at the most right side of the bar spacerItem = QtGui.QSpacerItem(40, 1, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout.addItem(spacerItem) self._addIndicatorLabels(Form,sizePolicy, indicators=["PointX","PointY","PointZ"])