Python PyQt5.QtWidgets 模块,QStackedWidget() 实例源码

我们从Python开源项目中,提取了以下8个代码示例,用于说明如何使用PyQt5.QtWidgets.QStackedWidget()

项目:OnCue    作者:featherbear    | 项目源码 | 文件源码
def __init__(self):
            """
            Set up the interface
            """
            super(Application, self).__init__()
            global selector
            self.setWindowTitle("OnCue")
            self.setWindowIcon(QtGui.QIcon("OnCue.ico"))
            self.resize(900, 900)
            self.setMinimumSize(self.size())
            self.setMaximumSize(self.size())
            self.setWindowFlags(QtCore.Qt.FramelessWindowHint)
            selector = QtWidgets.QStackedWidget()
            self.setCentralWidget(selector)
            states["interface"]["ui"] = [MAIN(), PREFERENCES()]
            [selector.addWidget(ui) for ui in states["interface"]["ui"]]
项目:BATS-Bayesian-Adaptive-Trial-Simulator    作者:ContaTP    | 项目源码 | 文件源码
def __init__(self, parent=None):

        QtWidgets.QStackedWidget.__init__(self, parent)
        # Design widget
        self.mamsWidget = MAMS_Design(parent)
        self.addWidget(self.mamsWidget)
项目:BATS-Bayesian-Adaptive-Trial-Simulator    作者:ContaTP    | 项目源码 | 文件源码
def __init__(self, parent=None):

        QtWidgets.QStackedWidget.__init__(self, parent)
        self.posteriorprobWidget = PosteriorProbability_Calculation(parent)
        self.addWidget(self.posteriorprobWidget)


# Window for plots
项目:OpenTutorials_PyQt    作者:RavenKyu    | 项目源码 | 文件源码
def __init__(self):
        QWidget.__init__(self, flags=Qt.Widget)
        self.stk_w = QStackedWidget(self)
        self.init_widget()
项目:binja-ui-api    作者:nbsdx    | 项目源码 | 文件源码
def TabWidget():
    app = _app()

    views = [x for x in app.allWidgets() if x.__class__ is QtWidgets.QListView]

    for view in views:
        if view.parent().__class__ is QtWidgets.QStackedWidget:
            if view.parent().parent().__class__ is QtWidgets.QTabWidget:
                return view.parent().parent()

    return None
项目:binja_dynamics    作者:nccgroup    | 项目源码 | 文件源码
def __init__(self, segments=None):
        """
        Initializes GUI components.
        Takes either no arguments, or a dict containing segment names and starting addresses
        """
        super(MemoryWindow, self).__init__()
        self.setWindowTitle("Memory")
        self.stack_pointer = None
        self.base_pointer = None
        self.retn_address = None
        self.instr_pointer = None

        if segments is not None:
            if type(segments) is not OrderedDict:
                print("Error: Use collections.OrderedDict instead of dict for segment list")
            self._segments = segments.keys()
            self.segment_starts = segments

        self.setLayout(QtWidgets.QVBoxLayout())
        self._layout = self.layout()

        self._picker = QtWidgets.QComboBox()
        for segment in self._segments:
            self._picker.addItem(segment)
        self._layout.addWidget(self._picker)
        # Call change_display_segment whenever the user messes with the combobox
        self._picker.currentIndexChanged.connect(self.change_display_segment)

        # viewstack controls switching between the different segments views
        self.viewstack = QtWidgets.QStackedWidget()
        for segment in self._segments:
            if self.segment_starts is None:
                disp = HexDisplay()
                disp.update_addr(0, "This is the " + segment + " segment")
            else:
                disp = HexDisplay(starting_address=self.segment_starts[segment])
            self.viewstack.addWidget(disp)

        self._layout.addWidget(self.viewstack)
        self.setMaximumWidth(self.viewstack.widget(0).maximumWidth() + 20)
        self.setMinimumWidth(self.viewstack.widget(0).minimumWidth() + 20)
        self.setObjectName('Memory_Window')
项目:BATS-Bayesian-Adaptive-Trial-Simulator    作者:ContaTP    | 项目源码 | 文件源码
def openAllGraph(self):

        self.plot_file_list = self.parent.plot_file[self.root_name]
        self.graphviewer = QtWidgets.QFrame()
        self.screen = QtWidgets.QDesktopWidget().screenGeometry()
        # Set geometry
        self.graphviewer.setGeometry(self.screen.width()/4, 100, 800, 600)
        self.graphviewer.setWindowFlags(QtCore.Qt.Popup)
        self.graphviewer.setObjectName("graphView")
        self.graphviewer.setStyleSheet("QFrame#graphView{background:#ffffff;border:0.5px solid #fa7064;} QPushButton:hover{background:#6e66cc;border:1px solid #373366;} QToolButton:hover{background:#fa7064;}")
        # self.graphviewer.setWindowModality(QtCore.Qt.WindowModal)
        # Layout
        graph_layout = QtWidgets.QVBoxLayout()
        # Title
        graph_title = SubTitleBar(self.graphviewer)
        graph_title.title_Label.setText(self.root_name)
        # Separator line
        hline = QtWidgets.QWidget()
        hline.setStyleSheet("QWidget{min-height:2px; max-height:2px; background:#399ee5;}")
        # ComboBox
        graph_control = QtWidgets.QWidget()
        graph_control_layout = QtWidgets.QHBoxLayout()
        self.graph_control_comboBox = QtWidgets.QComboBox()
        self.graph_control_comboBox.setStyleSheet("QComboBox{font-family:'Segoe UI';font-size: 10pt;border: 1px solid #c5d2d9; border-radius:5px;padding: 5px 10px 5px 10px; color: #66767c;min-width: 250px;} QComboBox:hover{border: 2px solid #2a4d69;border-radius: 5px;height: 30ps;} QComboBox::drop-down {subcontrol-origin: padding; subcontrol-position: top right;width: 40px;border-left-width: 2px;border-left-color: #c5d2d9;border-left-style: solid; border-top-right-radius: 5px; border-bottom-right-radius: 5px;padding: 1px 1px 1px 1px;image: url(:/resources/dropdown_arrow.png);} QComboBox QAbstractItemView {border: 1px solid #c5d2d9; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px;selection-background-color:#4b86b4;outline: solid #2a4d69;font-family: 'Segoe UI';font-size: 10pt;color: #66767c;}")
        graph_control_layout.insertStretch(0, 4)
        graph_control_layout.addWidget(self.graph_control_comboBox)
        graph_control_layout.insertStretch(3, 4)
        graph_control.setLayout(graph_control_layout)
        # Main Content
        self.graph_content = QtWidgets.QStackedWidget()
        # Add stack
        for i in range(1, len(self.plot_file_list)):

            currentName = self.plot_file_list[i].rsplit("/", 1)[1].rsplit(".", 1)[0]
            self.graph_control_comboBox.addItem(currentName)
            graph_label = QtWidgets.QLabel()            
            currentGraph = QtGui.QPixmap(self.plot_file_list[i])
            graph_label.setPixmap(currentGraph)
            graph_label.setAlignment(QtCore.Qt.AlignCenter)
            self.graph_content.addWidget(graph_label)

        # Add layout
        graph_layout.addWidget(graph_title, 1)
        graph_layout.addWidget(hline, 1)     
        graph_layout.addWidget(graph_control, 1)   
        graph_layout.addWidget(self.graph_content, 8)
        graph_layout.setContentsMargins(5, 10, 5, 10)
        graph_layout.setAlignment(QtCore.Qt.AlignTop)
        self.graphviewer.setLayout(graph_layout)
        self.graph_control_comboBox.currentIndexChanged.connect(self.changeGraph)
        self.graphviewer.show()
项目:binja_dynamics    作者:ehennenfent    | 项目源码 | 文件源码
def __init__(self, segments=None):
        """
        Initializes GUI components.
        Takes either no arguments, or a dict containing segment names and starting addresses
        """
        super(MemoryWindow, self).__init__()
        self.setWindowTitle("Memory")
        self.stack_pointer = None
        self.base_pointer = None
        self.retn_address = None
        self.instr_pointer = None

        if segments is not None:
            if type(segments) is not OrderedDict:
                print("Error: Use collections.OrderedDict instead of dict for segment list")
            self._segments = segments.keys()
            self.segment_starts = segments

        self.setLayout(QtWidgets.QVBoxLayout())
        self._layout = self.layout()

        self._picker = QtWidgets.QComboBox()
        for segment in self._segments:
            self._picker.addItem(segment)
        self._layout.addWidget(self._picker)
        # Call change_display_segment whenever the user messes with the combobox
        self._picker.currentIndexChanged.connect(self.change_display_segment)

        # viewstack controls switching between the different segments views
        self.viewstack = QtWidgets.QStackedWidget()
        for segment in self._segments:
            if self.segment_starts is None:
                disp = HexDisplay()
                disp.update_addr(0, "This is the " + segment + " segment")
            else:
                disp = HexDisplay(starting_address=self.segment_starts[segment])
            self.viewstack.addWidget(disp)

        self._layout.addWidget(self.viewstack)
        self.setMaximumWidth(self.viewstack.widget(0).maximumWidth() + 20)
        self.setMinimumWidth(self.viewstack.widget(0).minimumWidth() + 20)
        self.setObjectName('Memory_Window')