python类QPushButton()的实例源码

addition.py 文件源码 项目:MusicPlayer 作者: HuberTRoy 项目源码 文件源码 阅读 32 收藏 0 点赞 0 评论 0
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)
start.py 文件源码 项目:taobao 作者: laogewen 项目源码 文件源码 阅读 33 收藏 0 点赞 0 评论 0
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)
GUI.py 文件源码 项目:coliform-project 作者: uprm-research-resto 项目源码 文件源码 阅读 30 收藏 0 点赞 0 评论 0
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)
GUI.py 文件源码 项目:coliform-project 作者: uprm-research-resto 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
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)
GUI.py 文件源码 项目:coliform-project 作者: uprm-research-resto 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
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)
testapp.py 文件源码 项目:incubator-senssoft-userale-pyqt5 作者: apache 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
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()
about.py 文件源码 项目:pytc-gui 作者: harmslab 项目源码 文件源码 阅读 33 收藏 0 点赞 0 评论 0
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")
aic_test.py 文件源码 项目:pytc-gui 作者: harmslab 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
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')
documentation.py 文件源码 项目:pytc-gui 作者: harmslab 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
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")
global_dialog.py 文件源码 项目:pytc-gui 作者: harmslab 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
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")
__init__.py 文件源码 项目:binja_dynamics 作者: nccgroup 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
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')
inventory.py 文件源码 项目:activity-browser 作者: LCA-ActivityBrowser 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
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()
inventory.py 文件源码 项目:activity-browser 作者: LCA-ActivityBrowser 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
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()
db_import_wizard.py 文件源码 项目:activity-browser 作者: LCA-ActivityBrowser 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
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)
db_import_wizard.py 文件源码 项目:activity-browser 作者: LCA-ActivityBrowser 项目源码 文件源码 阅读 45 收藏 0 点赞 0 评论 0
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)
db_import_wizard.py 文件源码 项目:activity-browser 作者: LCA-ActivityBrowser 项目源码 文件源码 阅读 61 收藏 0 点赞 0 评论 0
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)
wb_hg_preferences.py 文件源码 项目:scm-workbench 作者: barry-scott 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
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 )
wb_git_preferences.py 文件源码 项目:scm-workbench 作者: barry-scott 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
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 )
wb_scm_preferences_dialog.py 文件源码 项目:scm-workbench 作者: barry-scott 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
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 )
main_ui_progress.py 文件源码 项目:EMFT 作者: 132nd-etcher 项目源码 文件源码 阅读 33 收藏 0 点赞 0 评论 0
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()
field_item_edit.py 文件源码 项目:git-annex-metadata-gui 作者: alpernebbi 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
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()
highlight_instructions.py 文件源码 项目:idapython 作者: mr-tz 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
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)
embedding.py 文件源码 项目:Dragonfly 作者: duaneloh 项目源码 文件源码 阅读 31 收藏 0 点赞 0 评论 0
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)
session.py 文件源码 项目:axopy 作者: ucdrascal 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
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)
colorPicker.py 文件源码 项目:OnCue 作者: featherbear 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
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
builtin.py 文件源码 项目:pyree-old 作者: DrLuke 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
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)
builtin.py 文件源码 项目:pyree-old 作者: DrLuke 项目源码 文件源码 阅读 37 收藏 0 点赞 0 评论 0
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)
track_hmd_qt.py 文件源码 项目:pyopenvr 作者: cmbruns 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
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
textbox.py 文件源码 项目:VIRTUAL-PHONE 作者: SumanKanrar-IEM 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
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()
horizontalLayout.py 文件源码 项目:VIRTUAL-PHONE 作者: SumanKanrar-IEM 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
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)


问题


面经


文章

微信
公众号

扫码关注公众号