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

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

项目:MusicPlayer    作者:HuberTRoy    | 项目源码 | 文件源码
def __init__(self, parent=None):
        super(SearchLineEdit, self).__init__()
        self.setObjectName("SearchLine")
        self.parent = parent
        self.setMinimumSize(218, 20)
        with open('QSS/searchLine.qss', 'r') as f:
            self.setStyleSheet(f.read())

        self.button = QPushButton(self)
        self.button.setMaximumSize(13, 13)
        self.button.setCursor(QCursor(Qt.PointingHandCursor))

        self.setTextMargins(3, 0, 19, 0)

        self.spaceItem = QSpacerItem(150, 10, QSizePolicy.Expanding)

        self.mainLayout = QHBoxLayout()
        self.mainLayout.addSpacerItem(self.spaceItem)
        # self.mainLayout.addStretch(1)
        self.mainLayout.addWidget(self.button)
        self.mainLayout.addSpacing(10)
        self.mainLayout.setContentsMargins(0, 0, 0, 0)
        self.setLayout(self.mainLayout)
项目:taobao    作者:laogewen    | 项目源码 | 文件源码
def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(564, 270)
        self.centralWidget = QtWidgets.QWidget(MainWindow)
        self.centralWidget.setObjectName("centralWidget")
        self.pushButton = QtWidgets.QPushButton(self.centralWidget)
        self.pushButton.setGeometry(QtCore.QRect(320, 60, 93, 28))
        self.pushButton.setObjectName("pushButton")
        self.textEdit = QtWidgets.QTextEdit(self.centralWidget)
        self.textEdit.setGeometry(QtCore.QRect(60, 60, 151, 31))
        self.textEdit.setObjectName("textEdit")
        self.pushButton_2 = QtWidgets.QPushButton(self.centralWidget)
        self.pushButton_2.setGeometry(QtCore.QRect(320, 150, 111, 28))
        self.pushButton_2.setObjectName("pushButton_2")
        self.label = QtWidgets.QLabel(self.centralWidget)
        self.label.setGeometry(QtCore.QRect(60, 30, 151, 16))
        self.label.setObjectName("label")
        self.label_2 = QtWidgets.QLabel(self.centralWidget)
        self.label_2.setGeometry(QtCore.QRect(60, 110, 151, 41))
        self.label_2.setObjectName("label_2")
        self.comboBox = QtWidgets.QComboBox(self.centralWidget)
        self.comboBox.setGeometry(QtCore.QRect(60, 160, 87, 22))
        self.comboBox.setObjectName("comboBox")
        MainWindow.setCentralWidget(self.centralWidget)
        self.menuBar = QtWidgets.QMenuBar(MainWindow)
        self.menuBar.setGeometry(QtCore.QRect(0, 0, 564, 26))
        self.menuBar.setObjectName("menuBar")
        MainWindow.setMenuBar(self.menuBar)
        self.mainToolBar = QtWidgets.QToolBar(MainWindow)
        self.mainToolBar.setObjectName("mainToolBar")
        MainWindow.addToolBar(QtCore.Qt.TopToolBarArea, self.mainToolBar)
        self.statusBar = QtWidgets.QStatusBar(MainWindow)
        self.statusBar.setObjectName("statusBar")
        MainWindow.setStatusBar(self.statusBar)

        self.comboBox.addItems(["%s" % x for x in range(1, 100)])
        self.pushButton.clicked.connect(self.start)

        self.retranslateUi(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)
项目:coliform-project    作者:uprm-research-resto    | 项目源码 | 文件源码
def createTopLeftGroupBox(self):
        self.topLeftGroupBox = QGroupBox("Temperature Sensor")

        tempLabel = QLabel('Temperature: ')
        self.tempValLabel = QLabel('NULL')

        plotButton = QPushButton("Show Plot")
        plotButton.clicked.connect(self.tempPlot)
        saveDataButton = QPushButton('Save Data File')
        saveDataButton.clicked.connect(self.savefile)

        vbox1 = QVBoxLayout()
        vbox1.addWidget(tempLabel)
        vbox1.addWidget(self.tempValLabel)

        vbox2 = QVBoxLayout()
        vbox2.addWidget(plotButton)
        vbox2.addWidget(saveDataButton)

        layout = QHBoxLayout()
        layout.addLayout(vbox1)
        layout.addLayout(vbox2)
        layout.addStretch(1)
        self.topLeftGroupBox.setLayout(layout)
项目:coliform-project    作者:uprm-research-resto    | 项目源码 | 文件源码
def createTopRightGroupBox(self):
        self.topRightGroupBox = QGroupBox('Heater')

        heatLabel = QLabel('Target Temperature(C):')
        heatEntry = QLineEdit()
        heatEntry.textChanged[str].connect(self.tempOnChanged)
        heatEntry.setText('41')

        self.heatButton = QPushButton('Heater ON')
        self.heatButton.clicked.connect(self.heaterPower)

        hbox1 = QHBoxLayout()
        hbox1.addWidget(heatLabel)
        hbox1.addWidget(heatEntry)

        hbox2 = QHBoxLayout()
        hbox2.addWidget(self.heatButton)

        layout = QVBoxLayout()
        layout.addLayout(hbox1)
        layout.addLayout(hbox2)
        layout.addStretch(1)
        self.topRightGroupBox.setLayout(layout)
项目:coliform-project    作者:uprm-research-resto    | 项目源码 | 文件源码
def createBottomLeftGroupBox(self):
        self.bottomLeftGroupBox = QGroupBox('Sensor Options')

        captureBtn = QPushButton('Capture Data')
        captureBtn.clicked.connect(self.captureDataThread)

        setNormOptionsBtn = QPushButton('Set Normal Options')
        setNormOptionsBtn.clicked.connect(self.normalSettings)

        setDarkOptionsBtn = QPushButton('Set Low Light Options')
        setDarkOptionsBtn.clicked.connect(self.darkSettings)

        saveBtn = QPushButton('Save Data')
        saveBtn.clicked.connect(self.saveData)

        layout = QVBoxLayout()
        layout.addWidget(captureBtn)
        layout.addWidget(setNormOptionsBtn)
        layout.addWidget(setDarkOptionsBtn)
        layout.addWidget(saveBtn)
        layout.addStretch(1)
        self.bottomLeftGroupBox.setLayout(layout)
项目:incubator-senssoft-userale-pyqt5    作者:apache    | 项目源码 | 文件源码
def initUI(self):               

        qbtn = QPushButton('Quit', self)
        qbtn.setObjectName ("testApplicationButton")
        qbtn.clicked.connect(QCoreApplication.instance().quit)
        qbtn.resize(qbtn.sizeHint())
        qbtn.move(50, 50)       

        self.setGeometry(300, 300, 250, 150)
        self.setWindowTitle('Quit button')    
        self.show()
项目:pytc-gui    作者:harmslab    | 项目源码 | 文件源码
def layout(self):
        """
        """
        main_layout = QW.QVBoxLayout(self)
        form_layout = QW.QFormLayout()

        version = pkg_resources.require("pytc-gui")[0].version

        name_label = QW.QLabel("pytc: GUI")
        name_font = name_label.font()
        name_font.setPointSize(20)
        name_label.setFont(name_font)
        name_label.setAlignment(Qt.AlignCenter)

        version_label = QW.QLabel("Version " + version)
        version_font = version_label.font()
        version_font.setPointSize(14)
        version_label.setFont(version_font)
        version_label.setAlignment(Qt.AlignCenter)

        author_info = QW.QLabel("Hiranmayi Duvvuri, Mike Harms")
        author_font = author_info.font()
        author_font.setPointSize(10)
        author_info.setFont(author_font)

        OK_button = QW.QPushButton("OK", self)
        OK_button.clicked.connect(self.close)

        main_layout.addWidget(name_label)
        main_layout.addWidget(version_label)
        main_layout.addWidget(author_info)
        main_layout.addWidget(OK_button)

        self.setWindowTitle("About")
项目:pytc-gui    作者:harmslab    | 项目源码 | 文件源码
def layout(self):
        """
        Lay out the dialog.
        """

        main_layout = QW.QVBoxLayout(self)
        test_layout = QW.QHBoxLayout()
        button_layout = QW.QVBoxLayout()

        self._fitter_select = QW.QListWidget()
        self._fitter_select.setSelectionMode(QW.QAbstractItemView.ExtendedSelection)

        for k,v in self._fit_snapshot_dict.items():
            self._fitter_select.addItem(k)

        self._fitter_select.setFixedSize(150, 100)

        ftest_button = QW.QPushButton("Perform AIC Test", self)
        ftest_button.clicked.connect(self.perform_test)

        add_fit_button = QW.QPushButton("Append New Fit", self)
        add_fit_button.clicked.connect(self.add_fitter)

        self._data_out = QW.QTextEdit()
        self._data_out.setReadOnly(True)
        self._data_out.setMinimumWidth(400)

        # add buttons to layout
        button_layout.addWidget(ftest_button)
        button_layout.addWidget(add_fit_button)

        # add widgets to layout
        test_layout.addWidget(self._fitter_select)
        test_layout.addLayout(button_layout)
        main_layout.addLayout(test_layout)
        main_layout.addWidget(self._data_out)

        self.setWindowTitle('AIC Test')
项目:pytc-gui    作者:harmslab    | 项目源码 | 文件源码
def layout(self):
        """
        """
        main_layout = QW.QVBoxLayout(self)
        form_layout = QW.QFormLayout()

        pytc_docs = "<a href=\"https://pytc.readthedocs.io/en/latest/\">documentation</a>"
        gui_docs = "<a href=\"https://pytc-gui.readthedocs.io/en/latest/\">documentation</a>"

        pytc_label = QW.QLabel(pytc_docs)
        pytc_label.setOpenExternalLinks(True)

        gui_label = QW.QLabel(gui_docs)
        gui_label.setOpenExternalLinks(True)

        form_layout.addRow(QW.QLabel("pytc:"), pytc_label)
        form_layout.addRow(QW.QLabel("pytc-gui:"), gui_label)

        OK_button = QW.QPushButton("OK", self)
        OK_button.clicked.connect(self.close)

        main_layout.addLayout(form_layout)
        main_layout.addWidget(OK_button)

        self.setWindowTitle("Documentation")
项目:pytc-gui    作者:harmslab    | 项目源码 | 文件源码
def layout(self):
        """
        Populate the window.
        """

        self._main_layout = QW.QVBoxLayout(self)
        self._form_layout = QW.QFormLayout()

        # Input box holding name
        self._global_var_input = QW.QLineEdit(self)
        self._global_var_input.setText("global")
        self._global_var_input.editingFinished.connect(self._check_name)

        # Final OK button
        self._OK_button = QW.QPushButton("OK", self)
        self._OK_button.clicked.connect(self._ok_button_handler)

        # Add to form
        self._form_layout.addRow(QW.QLabel("New Global Variable:"), self._global_var_input)

        # add to main layout
        self._main_layout.addLayout(self._form_layout)
        self._main_layout.addWidget(self._OK_button)

        self.setWindowTitle("Add new global variable")
项目:binja_dynamics    作者:nccgroup    | 项目源码 | 文件源码
def __init__(self):
        super(TracebackWindow, self).__init__()
        self.framelist = []
        self.ret_add = 0x0
        self.setWindowTitle("Traceback")
        self.setLayout(QtWidgets.QVBoxLayout())
        self._layout = self.layout()

        # Creates the rich text viewer that displays the traceback
        self._textBrowser = QtWidgets.QTextBrowser()
        self._textBrowser.setOpenLinks(False)
        self._textBrowser.setFont(QFontDatabase.systemFont(QFontDatabase.FixedFont))
        self._layout.addWidget(self._textBrowser)

        # Creates the button that displays the return address
        self._ret = QtWidgets.QPushButton()
        self._ret.setFlat(True)
        self._layout.addWidget(self._ret)

        self.resize(self.width(), int(self.height() * 0.5))

        self.setObjectName('Traceback_Window')
项目:activity-browser    作者:LCA-ActivityBrowser    | 项目源码 | 文件源码
def __init__(self):
        super(ProjectsWidget, self).__init__()
        self.projects_list = ProjectListWidget()
        # Buttons
        self.new_project_button = QtWidgets.QPushButton(QtGui.QIcon(icons.add), 'New')
        self.copy_project_button = QtWidgets.QPushButton(QtGui.QIcon(icons.copy), 'Copy current')
        self.delete_project_button = QtWidgets.QPushButton(QtGui.QIcon(icons.delete), 'Delete current')
        # Layout
        self.h_layout = QtWidgets.QHBoxLayout()
        self.h_layout.addWidget(header('Current Project:'))
        self.h_layout.addWidget(self.projects_list)
        self.h_layout.addWidget(self.new_project_button)
        self.h_layout.addWidget(self.copy_project_button)
        self.h_layout.addWidget(self.delete_project_button)
        self.setLayout(self.h_layout)
        self.setSizePolicy(QtWidgets.QSizePolicy(
            QtWidgets.QSizePolicy.Maximum,
            QtWidgets.QSizePolicy.Maximum)
        )
        self.connect_signals()
项目:activity-browser    作者:LCA-ActivityBrowser    | 项目源码 | 文件源码
def __init__(self, parent):
        super(DatabaseWidget, self).__init__(parent)

        # Labels
        self.label_no_database_selected = QtWidgets.QLabel("Select a database (double-click on table).")

        # Buttons
        self.add_default_data_button = QtWidgets.QPushButton(
            'Add Default Data (Biosphere flows, LCIA methods)')
        self.new_database_button = QtWidgets.QPushButton('New Database')
        self.import_database_button = QtWidgets.QPushButton('Import Database')

        # Header widget
        self.header_layout.addWidget(self.add_default_data_button)
        self.header_layout.addWidget(self.new_database_button)
        self.header_layout.addWidget(self.import_database_button)

        # Overall Layout
        self.v_layout.addWidget(self.label_no_database_selected)

        self.connect_signals()
项目:activity-browser    作者:LCA-ActivityBrowser    | 项目源码 | 文件源码
def __init__(self, parent=None):
        super().__init__(parent)
        self.path_edit = QtWidgets.QLineEdit()
        self.registerField('dirpath*', self.path_edit)
        self.browse_button = QtWidgets.QPushButton('Browse')
        self.browse_button.clicked.connect(self.get_directory)

        layout = QtWidgets.QVBoxLayout()
        layout.addWidget(QtWidgets.QLabel(
            'Choose location of existing ecospold2 directory:'))
        layout.addWidget(self.path_edit)
        browse_lay = QtWidgets.QHBoxLayout()
        browse_lay.addWidget(self.browse_button)
        browse_lay.addStretch(1)
        layout.addLayout(browse_lay)
        self.setLayout(layout)
项目:activity-browser    作者:LCA-ActivityBrowser    | 项目源码 | 文件源码
def __init__(self, parent=None):
        super().__init__(parent)
        self.wizard = self.parent()
        self.path_edit = QtWidgets.QLineEdit()
        self.registerField('archivepath*', self.path_edit)
        self.browse_button = QtWidgets.QPushButton('Browse')
        self.browse_button.clicked.connect(self.get_archive)

        layout = QtWidgets.QVBoxLayout()
        layout.addWidget(QtWidgets.QLabel(
            'Choose location of 7z archive:'))
        layout.addWidget(self.path_edit)
        browse_lay = QtWidgets.QHBoxLayout()
        browse_lay.addWidget(self.browse_button)
        browse_lay.addStretch(1)
        layout.addLayout(browse_lay)
        self.setLayout(layout)
项目:activity-browser    作者:LCA-ActivityBrowser    | 项目源码 | 文件源码
def __init__(self, parent=None):
        super().__init__(parent)
        self.wizard = self.parent()
        self.complete = False
        self.description_label = QtWidgets.QLabel('Login to the ecoinvent homepage:')
        self.username_edit = QtWidgets.QLineEdit()
        self.username_edit.setPlaceholderText('ecoinvent username')
        self.password_edit = QtWidgets.QLineEdit()
        self.password_edit.setPlaceholderText('ecoinvent password'),
        self.password_edit.setEchoMode(QtWidgets.QLineEdit.Password)
        self.login_button = QtWidgets.QPushButton('login')
        self.login_button.clicked.connect(self.login)
        self.login_button.setCheckable(True)
        self.password_edit.returnPressed.connect(self.login_button.click)
        self.success_label = QtWidgets.QLabel('')
        layout = QtWidgets.QVBoxLayout()
        layout.addWidget(self.description_label)
        layout.addWidget(self.username_edit)
        layout.addWidget(self.password_edit)
        hlay = QtWidgets.QHBoxLayout()
        hlay.addWidget(self.login_button)
        hlay.addStretch(1)
        layout.addLayout(hlay)
        layout.addWidget(self.success_label)
        self.setLayout(layout)
项目:scm-workbench    作者:barry-scott    | 项目源码 | 文件源码
def __init__( self, app ):
        super().__init__( app, T_('Hg') )

        self.prefs = self.app.prefs.hg

        #------------------------------------------------------------
        self.hg_program = QtWidgets.QLineEdit()
        if self.prefs.program is not None:
            self.hg_program.setText( str(self.prefs.program) )

        else:
            # show the default
            self.hg_program.setText( hglib.HGPATH )

        self.browse_program = QtWidgets.QPushButton( T_('Browse...') )
        self.browse_program.clicked.connect( self.__pickProgram )

        #------------------------------------------------------------
        self.addRow( T_('Hg Program'), self.hg_program, self.browse_program )
项目:scm-workbench    作者:barry-scott    | 项目源码 | 文件源码
def __init__( self, app ):
        super().__init__( app, T_('Git') )

        self.prefs = self.app.prefs.git

        #------------------------------------------------------------
        self.git_program = QtWidgets.QLineEdit()
        if self.prefs.program is not None:
            self.git_program.setText( str(self.prefs.program) )

        else:
            # show the default
            self.git_program.setText( git.Git.GIT_PYTHON_GIT_EXECUTABLE )

        self.browse_program = QtWidgets.QPushButton( T_('Browse...') )
        self.browse_program.clicked.connect( self.__pickProgram )

        self.addRow( T_('Git Program'), self.git_program, self.browse_program )
项目:scm-workbench    作者:barry-scott    | 项目源码 | 文件源码
def __init__( self, app ):
        super().__init__( app, T_('Editor') )

        if self.app is None:
            self.prefs = None
        else:
            self.prefs = self.app.prefs.editor

        self.editor_program = QtWidgets.QLineEdit( '' )
        self.editor_options = QtWidgets.QLineEdit( '' )

        if self.prefs is not None:
            self.editor_program.setText( self.prefs.program )
            self.editor_options.setText( self.prefs.options )

        self.browse = QtWidgets.QPushButton( T_('Browse…') )

        self.addRow( T_('Editor'), self.editor_program, self.browse )
        self.addRow( T_('Editor Options'), self.editor_options )

        self.browse.clicked.connect( self.pickEditor )
项目:EMFT    作者:132nd-etcher    | 项目源码 | 文件源码
def progress_start(title: str = '', length: int = 100, label: str = ''):
        MainUiProgress.progress = QProgressDialog()
        MainUiProgress.progress.setWindowFlags(Qt.FramelessWindowHint)
        MainUiProgress.progress.setWindowFlags(Qt.WindowTitleHint)
        MainUiProgress.progress.setMinimumWidth(400)
        from PyQt5.QtWidgets import QPushButton
        # QString() seems to be deprecated in v5
        # PyQt does not support setCancelButton(0) as it expects a QPushButton instance
        # Get your shit together, Qt !
        MainUiProgress.progress.findChild(QPushButton).hide()
        MainUiProgress.progress.setMinimumDuration(1)
        MainUiProgress.progress.setWindowModality(Qt.ApplicationModal)
        MainUiProgress.progress.setCancelButtonText('')
        MainUiProgress.progress.setWindowIcon(QIcon(':/ico/app.ico'))
        MainUiProgress.progress.setWindowTitle(title)
        MainUiProgress.progress.setLabelText(label)
        MainUiProgress.progress.setMaximum(length)
        MainUiProgress.progress.show()
项目:git-annex-metadata-gui    作者:alpernebbi    | 项目源码 | 文件源码
def __init__(self, item, parent=None):
        super().__init__(parent)
        self._item = item
        self._values = []

        layout = QtWidgets.QHBoxLayout(self)
        layout.setContentsMargins(0, 0, 0, 0)
        self.setLayout(layout)

        model = self._item.model()
        model.dataChanged.connect(self._on_data_changed)

        append_button = QtWidgets.QPushButton()
        append_button.setText('+')
        append_button.setMaximumWidth(32)
        append_button.clicked.connect(self._on_append_button_clicked)
        self.layout().addWidget(append_button)

        self.update_widgets()
项目:idapython    作者:mr-tz    | 项目源码 | 文件源码
def __init__(self, parent=None):
        QtWidgets.QDialog.__init__(self, parent, QtCore.Qt.WindowSystemMenuHint | QtCore.Qt.WindowCloseButtonHint)
        self.setWindowTitle("Highlighter v%s" % __version__)
        highlighter_layout = QtWidgets.QVBoxLayout()

        button_highlight = QtWidgets.QPushButton("&Highlight instructions")
        button_highlight.setDefault(True)
        button_highlight.clicked.connect(self.highlight)
        highlighter_layout.addWidget(button_highlight)

        button_clear = QtWidgets.QPushButton("&Clear all highlights")
        button_clear.clicked.connect(self.clear_colors)
        highlighter_layout.addWidget(button_clear)

        button_cancel = QtWidgets.QPushButton("&Close")
        button_cancel.clicked.connect(self.close)
        highlighter_layout.addWidget(button_cancel)

        self.setMinimumWidth(180)
        self.setLayout(highlighter_layout)
项目:Dragonfly    作者:duaneloh    | 项目源码 | 文件源码
def add_classes_frame(self):
        self.vbox.setStretch(self.vbox.count()-1, 0)

        hbox = QtWidgets.QHBoxLayout()
        self.vbox.addLayout(hbox)
        self.class_line = QtWidgets.QGridLayout()
        hbox.addLayout(self.class_line)
        hbox.addStretch(1)
        self.class_num = QtWidgets.QButtonGroup()
        self.refresh_classes()

        hbox = QtWidgets.QHBoxLayout()
        self.vbox.addLayout(hbox)
        button = QtWidgets.QPushButton('Show', self)
        button.clicked.connect(self.show_selected_class)
        hbox.addWidget(button)
        button = QtWidgets.QPushButton('See all', self)
        button.clicked.connect(self.show_all_classes)
        hbox.addWidget(button)
        button = QtWidgets.QPushButton('Refresh', self)
        button.clicked.connect(self.refresh_classes)
        hbox.addWidget(button)
        hbox.addStretch(1)

        self.vbox.addStretch(1)
项目:axopy    作者:ucdrascal    | 项目源码 | 文件源码
def __init__(self, configurations=None, parent=None):
        super(SessionInfoWidget, self).__init__(parent=parent)

        main_layout = QtWidgets.QVBoxLayout()
        self.setLayout(main_layout)

        form_layout = QtWidgets.QFormLayout()
        form_layout.setFormAlignment(QtCore.Qt.AlignVCenter)
        main_layout.addLayout(form_layout)

        if configurations is not None:
            self._config_combo_box = QtWidgets.QComboBox()
            form_layout.addRow("Configuration", self._config_combo_box)

            for config in configurations:
                self._config_combo_box.addItem(config)

        self._subject_line_edit = QtWidgets.QLineEdit()
        form_layout.addRow("Subject", self._subject_line_edit)

        self._button = QtWidgets.QPushButton("Start")
        main_layout.addWidget(self._button)

        self._button.clicked.connect(self._on_button_click)
项目:OnCue    作者:featherbear    | 项目源码 | 文件源码
def __init__(self):
        QtWidgets.QColorDialog.__init__(self)
        self.setOption(QtWidgets.QColorDialog.NoButtons)
        """
        QColorDialog
            [0] PyQt5.QtWidgets.QVBoxLayout
            [1] PyQt5.QtWidgets.QWidget             | Basic Color Grid
            [2] PyQt5.QtWidgets.QLabel              | Basic Color Label
            [3] PyQt5.QtWidgets.QPushButton         | Pick Screen Color Button
            [4] PyQt5.QtWidgets.QLabel              | Background for the colour preview
            [5] PyQt5.QtWidgets.QWidget             | Custom Color Grid
            [6] PyQt5.QtWidgets.QLabel              | Custom Color Label
            [7] PyQt5.QtWidgets.QPushButton         | Add to Custom Colors Button
            [8] PyQt5.QtWidgets.QFrame              | Hue Saturation Picker
            [9] PyQt5.QtWidgets.QWidget             | Intensity Slider
            [10] PyQt5.QtWidgets.QWidget            | Value and Preview
            [11] PyQt5.QtWidgets.QDialogButtonBox   | Dialog Buttons
            [12] PyQt5.QtCore.QTimer                | ???
        """
        self.children()[10].children()[16].setText("&Hex:")
        [self.children()[1].setParent(None) for elem in range(7)]  # Remove elements 1-7
        self.updateColor()
        # Elements 0, 8, 9, 10, 11 are important
项目:pyree-old    作者:DrLuke    | 项目源码 | 文件源码
def __init__(self, extraData, sheetview, sheethandler):
            super().__init__()

            self.data = extraData

            self.sheetview = sheetview
            self.sheethandler = sheethandler

            self.containerWidgetLayout = QFormLayout(self)
            self.containerWidgetLayout.setFieldGrowthPolicy(QFormLayout.ExpandingFieldsGrow)
            self.containerWidgetLayout.setContentsMargins(6, 6, 6, 6)

            self.containerWidgetLayout.addRow("Enter contents of your string below", None)

            self.plainTextEdit = QPlainTextEdit()
            if "string" in self.data:
                self.plainTextEdit.setPlainText(self.data["string"])
            self.plainTextEdit.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
            self.containerWidgetLayout.addRow(self.plainTextEdit)

            self.okButton = QPushButton()
            self.okButton.setText("Ok")
            self.okButton.clicked.connect(self.okclicked)
            self.containerWidgetLayout.addRow(self.okButton)
项目:pyree-old    作者:DrLuke    | 项目源码 | 文件源码
def __init__(self, extraData, sheetview, sheethandler):
            super().__init__()

            self.data = extraData

            self.sheetview = sheetview
            self.sheethandler = sheethandler

            self.containerWidgetLayout = QFormLayout(self)
            self.containerWidgetLayout.setFieldGrowthPolicy(QFormLayout.ExpandingFieldsGrow)
            self.containerWidgetLayout.setContentsMargins(6, 6, 6, 6)

            self.containerWidgetLayout.addRow("Enter the names of sheets that are in the mix (one sheet per line):", None)

            self.plainTextEdit = QPlainTextEdit()
            if "string" in self.data:
                self.plainTextEdit.setPlainText(self.data["string"])
            self.plainTextEdit.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
            self.containerWidgetLayout.addRow(self.plainTextEdit)

            self.okButton = QPushButton()
            self.okButton.setText("Ok")
            self.okButton.clicked.connect(self.okclicked)
            self.containerWidgetLayout.addRow(self.okButton)
项目:pyopenvr    作者:cmbruns    | 项目源码 | 文件源码
def __init__(self):
        QWidget.__init__(self)

        self.resize(1600, 940)
        self.setWindowTitle('OpenVR tracking data')

        self.webview = QWebEngineView()

        self.button = QPushButton('Quit', self)
        self.button.clicked.connect(self.close)
        layout = QVBoxLayout(self)
        layout.setSpacing(0)
        # layout.setMargin(0)
        layout.addWidget(self.button)
        layout.addWidget(self.webview)

        # XXX check result
        openvr.init(openvr.VRApplication_Scene)        
        poses_t = openvr.TrackedDevicePose_t * openvr.k_unMaxTrackedDeviceCount
        self.poses = poses_t()

        self.timer = QTimer()
        self.timer.timeout.connect(self.update_page)
        self.timer.start(50)   # ms
项目:VIRTUAL-PHONE    作者:SumanKanrar-IEM    | 项目源码 | 文件源码
def initUI(self):
        self.setWindowTitle(self.title)
        self.setGeometry(self.left, self.top, self.width, self.height)

        # Create textbox
        self.textbox = QLineEdit(self)
        self.textbox.move(20, 20)
        self.textbox.resize(280,40)

        # Create a button in the window
        self.button = QPushButton('Show text', self)
        self.button.move(20,80)

        # connect button to function on_click
        self.button.clicked.connect(self.on_click)
        self.show()
项目:VIRTUAL-PHONE    作者:SumanKanrar-IEM    | 项目源码 | 文件源码
def createHorizontalLayout(self):
        self.horizontalGroupBox = QGroupBox("What is your favorite color?")
        layout = QHBoxLayout()

        buttonBlue = QPushButton('Blue', self)
        buttonBlue.clicked.connect(self.on_click)
        layout.addWidget(buttonBlue) 

        buttonRed = QPushButton('Red', self)
        buttonRed.clicked.connect(self.on_click)
        layout.addWidget(buttonRed) 

        buttonGreen = QPushButton('Green', self)
        buttonGreen.clicked.connect(self.on_click)
        layout.addWidget(buttonGreen) 

        self.horizontalGroupBox.setLayout(layout)
项目:VIRTUAL-PHONE    作者:SumanKanrar-IEM    | 项目源码 | 文件源码
def createGridLayout(self):
        self.horizontalGroupBox = QGroupBox("Grid")
        layout = QGridLayout()
        layout.setColumnStretch(1, 4)
        layout.setColumnStretch(2, 4)

        layout.addWidget(QPushButton('1'),0,0) 
        layout.addWidget(QPushButton('2'),0,1) 
        layout.addWidget(QPushButton('3'),0,2) 
        layout.addWidget(QPushButton('4'),1,0) 
        layout.addWidget(QPushButton('5'),1,1) 
        layout.addWidget(QPushButton('6'),1,2) 
        layout.addWidget(QPushButton('7'),2,0) 
        layout.addWidget(QPushButton('8'),2,1) 
        layout.addWidget(QPushButton('9'),2,2) 

        self.horizontalGroupBox.setLayout(layout)
项目:VIRTUAL-PHONE    作者:SumanKanrar-IEM    | 项目源码 | 文件源码
def __init__(self, parent):   
        super(QWidget, self).__init__(parent)
        self.layout = QVBoxLayout(self)

        # Initialize tab screen
        self.tabs = QTabWidget()
        self.tab1 = QWidget()   
        self.tab2 = QWidget()
        self.tabs.resize(300,200) 

        # Add tabs
        self.tabs.addTab(self.tab1,"Tab 1")
        self.tabs.addTab(self.tab2,"Tab 2")

        # Create first tab
        self.tab1.layout = QVBoxLayout(self)
        self.pushButton1 = QPushButton("PyQt5 button")
        self.tab1.layout.addWidget(self.pushButton1)
        self.tab1.setLayout(self.tab1.layout)

        # Add tabs to widget        
        self.layout.addWidget(self.tabs)
        self.setLayout(self.layout)
项目:VIRTUAL-PHONE    作者:SumanKanrar-IEM    | 项目源码 | 文件源码
def window():
    app = QtWidgets.QApplication(sys.argv)
    w = QtWidgets.QWidget()
    b = QtWidgets.QPushButton('Push Me')
    l = QtWidgets.QLabel('Look at me')

    h_box = QtWidgets.QHBoxLayout()
    h_box.addStretch()
    h_box.addWidget(l)
    h_box.addStretch()

    v_box = QtWidgets.QVBoxLayout()
    v_box.addWidget(b)
    v_box.addLayout(h_box)

    w.setLayout(v_box)

    w.setWindowTitle('PyQt5 Lesson 4')
    w.show()

    sys.exit(app.exec_())
项目:VIRTUAL-PHONE    作者:SumanKanrar-IEM    | 项目源码 | 文件源码
def __init__(self):
        super().__init__()
        self.text = QTextEdit(self)
        self.clr_btn = QPushButton('Clear')
        self.sav_btn = QPushButton('Save')
        self.opn_btn = QPushButton('Open')
        self.font_btn = QPushButton('Change Font')

        self.init_ui()
项目:VIRTUAL-PHONE    作者:SumanKanrar-IEM    | 项目源码 | 文件源码
def init_ui(self):
        self.le = QtWidgets.QLineEdit()
        self.b1 = QtWidgets.QPushButton('Clear')
        self.b2 = QtWidgets.QPushButton('Print')

        v_box = QtWidgets.QVBoxLayout()
        v_box.addWidget(self.le)
        v_box.addWidget(self.b1)
        v_box.addWidget(self.b2)

        self.setLayout(v_box)
        self.setWindowTitle('PyQt5 Lesson 7')

        self.b1.clicked.connect(self.btn_clk)
        self.b2.clicked.connect(self.btn_clk)

        self.show()
项目:VIRTUAL-PHONE    作者:SumanKanrar-IEM    | 项目源码 | 文件源码
def init_ui(self):
        self.b = QtWidgets.QPushButton('Push Me')
        self.l = QtWidgets.QLabel('I have not been clicked yet')

        h_box = QtWidgets.QHBoxLayout()
        h_box.addStretch()
        h_box.addWidget(self.l)
        h_box.addStretch()

        v_box = QtWidgets.QVBoxLayout()
        v_box.addWidget(self.b)
        v_box.addLayout(h_box)

        self.setLayout(v_box)
        self.setWindowTitle('PyQt5 Lesson 5')

        self.b.clicked.connect(self.btn_click)

        self.show()
项目:VIRTUAL-PHONE    作者:SumanKanrar-IEM    | 项目源码 | 文件源码
def __init__(self):
        super(Notepad, self).__init__()
        self.text = QTextEdit(self)
        self.clr_btn = QPushButton('Clear')

        self.init_ui()
项目:VIRTUAL-PHONE    作者:SumanKanrar-IEM    | 项目源码 | 文件源码
def __init__(self):
        super(Notepad, self).__init__()
        self.text = QTextEdit(self)
        self.clr_btn = QPushButton('Clear')
        self.sav_btn = QPushButton('Save')
        self.opn_btn = QPushButton('Open')

        self.init_ui()
项目:VIRTUAL-PHONE    作者:SumanKanrar-IEM    | 项目源码 | 文件源码
def __init__(self):
        super(Notepad, self).__init__()
        self.text = QTextEdit(self)
        self.clr_btn = QPushButton('Save')

        self.init_ui()
项目:VIRTUAL-PHONE    作者:SumanKanrar-IEM    | 项目源码 | 文件源码
def __init__(self):
        super().__init__()
        self.text = QTextEdit(self)
        self.clr_btn = QPushButton('Clear')
        self.sav_btn = QPushButton('Save')
        self.opn_btn = QPushButton('Open')
        self.font_btn = QPushButton('Change Font')
        # self.clr_btn.setStyle(QStyleFactory.create('Fusion'))
        # self.sav_btn.setStyle(QStyleFactory.create('Windows'))
        # self.opn_btn.setStyle(QStyleFactory.create('Cleanlooks'))

        self.init_ui()
项目:Crawler_UI_New    作者:crystalhsj    | 项目源码 | 文件源码
def setupUi(self, Help):
        Help.setObjectName("Help")
        Help.resize(300, 400)
        Help.setMinimumSize(QtCore.QSize(300, 400))
        Help.setMaximumSize(QtCore.QSize(300, 400))
        self.plainTextEdit = QtWidgets.QPlainTextEdit(Help)
        self.plainTextEdit.setGeometry(QtCore.QRect(0, 0, 301, 341))
        self.plainTextEdit.setTextInteractionFlags(QtCore.Qt.TextSelectableByKeyboard|QtCore.Qt.TextSelectableByMouse)
        self.plainTextEdit.setObjectName("plainTextEdit")
        self.pushButton = QtWidgets.QPushButton(Help)
        self.pushButton.setGeometry(QtCore.QRect(100, 360, 99, 27))
        self.pushButton.setObjectName("pushButton")

        self.retranslateUi(Help)
        self.pushButton.clicked.connect(Help.close)
        QtCore.QMetaObject.connectSlotsByName(Help)
项目:Crawler_UI_New    作者:crystalhsj    | 项目源码 | 文件源码
def setupUi(self, Login):
        Login.setObjectName("Login")
        Login.resize(300, 400)
        Login.setMinimumSize(QtCore.QSize(300, 400))
        Login.setMaximumSize(QtCore.QSize(300, 400))
        self.pushButton = QtWidgets.QPushButton(Login)
        self.pushButton.setGeometry(QtCore.QRect(100, 320, 99, 27))
        self.pushButton.setObjectName("pushButton")
        self.label_2 = QtWidgets.QLabel(Login)
        self.label_2.setGeometry(QtCore.QRect(28, 190, 68, 17))
        self.label_2.setObjectName("label_2")
        self.lineEdit_2 = QtWidgets.QLineEdit(Login)
        self.lineEdit_2.setGeometry(QtCore.QRect(120, 190, 151, 27))
        self.lineEdit_2.setEchoMode(QtWidgets.QLineEdit.Password)
        self.lineEdit_2.setObjectName("lineEdit_2")
        self.label = QtWidgets.QLabel(Login)
        self.label.setGeometry(QtCore.QRect(28, 120, 68, 17))
        self.label.setObjectName("label")
        self.lineEdit = QtWidgets.QLineEdit(Login)
        self.lineEdit.setGeometry(QtCore.QRect(120, 120, 151, 27))
        self.lineEdit.setObjectName("lineEdit")

        self.retranslateUi(Login)
        QtCore.QMetaObject.connectSlotsByName(Login)
项目:Vector-Tiles-Reader-QGIS-Plugin    作者:geometalab    | 项目源码 | 文件源码
def setupUi(self, DlgAbout):
        DlgAbout.setObjectName("DlgAbout")
        DlgAbout.resize(382, 372)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Minimum)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(DlgAbout.sizePolicy().hasHeightForWidth())
        DlgAbout.setSizePolicy(sizePolicy)
        self.gridLayout = QtWidgets.QGridLayout(DlgAbout)
        self.gridLayout.setObjectName("gridLayout")
        self.btnClose = QtWidgets.QPushButton(DlgAbout)
        self.btnClose.setMinimumSize(QtCore.QSize(80, 0))
        self.btnClose.setObjectName("btnClose")
        self.gridLayout.addWidget(self.btnClose, 1, 0, 1, 1, QtCore.Qt.AlignRight)
        self.txtAbout = QtWidgets.QTextBrowser(DlgAbout)
        self.txtAbout.setMinimumSize(QtCore.QSize(350, 240))
        self.txtAbout.setOpenExternalLinks(True)
        self.txtAbout.setObjectName("txtAbout")
        self.gridLayout.addWidget(self.txtAbout, 0, 0, 1, 1)

        self.retranslateUi(DlgAbout)
        self.btnClose.clicked.connect(DlgAbout.reject)
        QtCore.QMetaObject.connectSlotsByName(DlgAbout)
项目:binja_dynamics    作者:ehennenfent    | 项目源码 | 文件源码
def __init__(self):
        super(TracebackWindow, self).__init__()
        self.framelist = []
        self.ret_add = 0x0
        self.setWindowTitle("Traceback")
        self.setLayout(QtWidgets.QVBoxLayout())
        self._layout = self.layout()

        # Creates the rich text viewer that displays the traceback
        self._textBrowser = QtWidgets.QTextBrowser()
        self._textBrowser.setOpenLinks(False)
        self._textBrowser.setFont(QFontDatabase.systemFont(QFontDatabase.FixedFont))
        self._layout.addWidget(self._textBrowser)

        # Creates the button that displays the return address
        self._ret = QtWidgets.QPushButton()
        self._ret.setFlat(True)
        self._layout.addWidget(self._ret)

        self.resize(self.width(), int(self.height() * 0.5))

        self.setObjectName('Traceback_Window')
项目:BAG_framework    作者:ucb-art    | 项目源码 | 文件源码
def __init__(self, parent=None):
        QtWidgets.QFrame.__init__(self, parent=parent)

        self.logger = QtWidgets.QPlainTextEdit(parent=self)
        self.logger.setReadOnly(True)
        self.logger.setLineWrapMode(QtWidgets.QPlainTextEdit.NoWrap)
        self.logger.setMinimumWidth(1100)
        self.buffer = ''

        self.clear_button = QtWidgets.QPushButton('Clear Log', parent=self)
        self.clear_button.clicked.connect(self.clear_log)
        self.save_button = QtWidgets.QPushButton('Save Log As...', parent=self)
        self.save_button.clicked.connect(self.save_log)

        self.lay = QtWidgets.QVBoxLayout(self)
        self.lay.addWidget(self.logger)
        self.lay.addWidget(self.clear_button)
        self.lay.addWidget(self.save_button)
项目:Enibar    作者:ENIB    | 项目源码 | 文件源码
def __init__(self):
        super().__init__()
        self.layout = QtWidgets.QGridLayout()
        self.setStyleSheet("QPushButton{margin:0.5em 0 0 0;padding:0.25em 1em}")

        self.username_label = QtWidgets.QLabel("Nom d'utilisateur:", self)
        self.password_label = QtWidgets.QLabel("Mot de passe:", self)
        self.username_input = QtWidgets.QLineEdit(self)
        self.password_input = QtWidgets.QLineEdit(self)
        self.password_input.setEchoMode(QtWidgets.QLineEdit.Password)
        self.cancel_button = QtWidgets.QPushButton("Annuler", self)
        self.validation_button = QtWidgets.QPushButton("Ajouter", self)

        self.layout.addWidget(self.username_label, 0, 0)
        self.layout.addWidget(self.username_input, 1, 0, 1, 0)
        self.layout.addWidget(self.password_label, 2, 0)
        self.layout.addWidget(self.password_input, 3, 0, 1, 0)
        self.layout.addWidget(self.validation_button, 4, 0)
        self.layout.addWidget(self.cancel_button, 4, 1)

        self.cancel_button.setAutoDefault(False)
        self.setLayout(self.layout)

        self.cancel_button.clicked.connect(self.reject)
        self.validation_button.clicked.connect(self.accept)
项目:CeNet-Interconnect    作者:shikharsrivastava    | 项目源码 | 文件源码
def setupUi(self, chatBox,message):
        chatBox.setObjectName("chatBox")
        chatBox.resize(473, 294)
        self.gridLayout = QtWidgets.QGridLayout(chatBox)
        self.gridLayout.setObjectName("gridLayout")
        self.verticalLayout = QtWidgets.QVBoxLayout()
        self.verticalLayout.setObjectName("verticalLayout")
        self.chatLabel = QtWidgets.QLabel(chatBox)
        self.chatLabel.setObjectName("chatLabel")
        self.verticalLayout.addWidget(self.chatLabel)
        self.userChat = chatText(chatBox)
        self.userChat.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded)
        self.userChat.setObjectName("userChat")
        self.verticalLayout.addWidget(self.userChat)
        self.gridLayout.addLayout(self.verticalLayout, 1, 0, 4, 1)
        self.chat = QtWidgets.QTextEdit(chatBox)
        self.chat.setEnabled(True)
        self.chat.setReadOnly(True)
        self.chat.setObjectName("chat")
        self.gridLayout.addWidget(self.chat, 0, 0, 1, 2)
        self.listOnline = QtWidgets.QPushButton(chatBox)
        self.listOnline.setObjectName("listOnline")
        self.gridLayout.addWidget(self.listOnline, 1, 1, 1, 1)
        self.sendButton = QtWidgets.QPushButton(chatBox)
        self.sendButton.setObjectName("sendButton")
        self.gridLayout.addWidget(self.sendButton, 3, 1, 1, 1)
        self.exitButton = QtWidgets.QPushButton(chatBox)
        self.exitButton.setObjectName("exitButton")
        self.gridLayout.addWidget(self.exitButton, 4, 1, 1, 1)
        self.fileSendButton = QtWidgets.QPushButton(chatBox)
        self.fileSendButton.setObjectName("fileSendButton")
        self.gridLayout.addWidget(self.fileSendButton, 2, 1, 1, 1)

        self.retranslateUi(chatBox,message)
        QtCore.QMetaObject.connectSlotsByName(chatBox)
项目:CeNet-Interconnect    作者:shikharsrivastava    | 项目源码 | 文件源码
def setupUi(self, chatBox,message):
        chatBox.setObjectName("chatBox")
        chatBox.resize(473, 294)
        self.gridLayout = QtWidgets.QGridLayout(chatBox)
        self.gridLayout.setObjectName("gridLayout")
        self.verticalLayout = QtWidgets.QVBoxLayout()
        self.verticalLayout.setObjectName("verticalLayout")
        self.chatLabel = QtWidgets.QLabel(chatBox)
        self.chatLabel.setObjectName("chatLabel")
        self.verticalLayout.addWidget(self.chatLabel)
        self.userChat = QtWidgets.QTextEdit(chatBox)
        self.userChat.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded)
        self.userChat.setObjectName("userChat")
        self.verticalLayout.addWidget(self.userChat)
        self.gridLayout.addLayout(self.verticalLayout, 1, 0, 4, 1)
        self.chat = QtWidgets.QTextEdit(chatBox)
        self.chat.setEnabled(True)
        self.chat.setReadOnly(True)
        self.chat.setObjectName("chat")
        self.gridLayout.addWidget(self.chat, 0, 0, 1, 2)
        self.listOnline = QtWidgets.QPushButton(chatBox)
        self.listOnline.setObjectName("listOnline")
        self.gridLayout.addWidget(self.listOnline, 1, 1, 1, 1)
        self.sendButton = QtWidgets.QPushButton(chatBox)
        self.sendButton.setObjectName("sendButton")
        self.gridLayout.addWidget(self.sendButton, 3, 1, 1, 1)
        self.exitButton = QtWidgets.QPushButton(chatBox)
        self.exitButton.setObjectName("exitButton")
        self.gridLayout.addWidget(self.exitButton, 4, 1, 1, 1)
        self.fileSendButton = QtWidgets.QPushButton(chatBox)
        self.fileSendButton.setObjectName("fileSendButton")
        self.gridLayout.addWidget(self.fileSendButton, 2, 1, 1, 1)

        self.retranslateUi(chatBox,message)
        self.exitButton.clicked.connect(chatBox.close)
        self.sendButton.clicked.connect(self.userChat.clear)
        self.fileSendButton.clicked.connect(self.userChat.clear)
        QtCore.QMetaObject.connectSlotsByName(chatBox)
项目:vivisect-py3    作者:bat-serjo    | 项目源码 | 文件源码
def __init__(self, trace=None, parent=None):
        QtWidgets.QWidget.__init__(self, parent=parent)
        VQTraceNotifier.__init__(self, trace)

        self.grid = QtWidgets.QGridLayout()
        if not trace.hasStatusRegister():
            return

        self.flags_def = trace.getStatusRegNameDesc()
        self.flags = {}
        self.flag_labels = {}
        for idx, (name, desc) in enumerate(self.flags_def):
            flag_button = QtWidgets.QPushButton(name)
            flag_button.clicked.connect(self.buttonClicked)
            flag_button.setToolTip(desc)

            flag_label = QtWidgets.QLabel('0', self)
            flag_label.setAlignment(QtCore.Qt.AlignCenter)
            self.flag_labels[name] = flag_label

            self.grid.addWidget(flag_button, 0, idx)
            self.grid.addWidget(flag_label, 1, idx)

        self.setLayout(self.grid)
        self.vqLoad()
项目:gpvdm    作者:roderickmackenzie    | 项目源码 | 文件源码
def __init__(self,x_min,x_max,data):
        QWidget.__init__(self)
        self.setWindowTitle(_("Poly fit")+"(https://www.gpvdm.com)") 
        self.data=data
        self.ret_math=None
        self.ret=None
        self.interal_data=[]
        for i in range (0,self.data.y_len):     #x_nm= [x * 1e9 for x in self.data.y_scale]
            x=self.data.y_scale[i]
            #print(x_min,x,x_max)
            if x>=x_min and x<=x_max:
                self.interal_data.append((self.data.y_scale[i],self.data.data[0][0][i]))
                #print(self.data.y_scale[i],self.data.data[0][0][i])
            #frequency, = self.ax1.plot(x_nm,self.data.data[0][0][i], 'bo-', linewidth=3 ,alpha=1.0)
        #print(self.interal_data)
        self.main_vbox=QVBoxLayout()
        self.label = QLabel(_("Polynomial coefficients"))
        self.main_vbox.addWidget(self.label)
        self.sp = QSpinBox()
        self.main_vbox.addWidget(self.sp)
        self.button = QPushButton(_("Ok"), self)
        self.button.clicked.connect(self.callback_click_ok)
        self.main_vbox.addWidget(self.button)
        self.setLayout(self.main_vbox)
        ret=False