def __init__(self, parent, top): super(QWidget, self).__init__(parent) self.top = top hlayout = QHBoxLayout() self.layout = QGridLayout() hlayout.addLayout(self.layout) hlayout.setAlignment(hlayout, Qt.Alignment.AlignTop) self.setLayout(hlayout) self.row = 0 self.__addLabel__("Federate Name") self.federateName = QLineEdit('REMOTE_WORKSTATION') self.__addInput__(self.federateName) self.__addLabel__("Message Directory Cache") self.messageDirectoryCache = QLineEdit(self) self.__addInputAndSelect__(self.messageDirectoryCache, self.top) self.__addLabel__("Map Data Cache") self.mapDataCache = QLineEdit(self) self.__addInputAndSelect__(self.mapDataCache, self.top) self.__addLabel__("Raster Map Cache") self.rasterMapCache = QLineEdit(self) self.__addInputAndSelect__(self.rasterMapCache, self.top) self.__addLabel__("Remote Control Location") self.remoteControlLocation = QLineEdit(self) self.__addInputAndSelect__(self.remoteControlLocation, self.top)
def initUi(self): self.setWindowTitle('Calculadora Suma 💻') self.setFixedSize(300, 400) self.lbl_numero_1 = QLabel('Número 1: ', self) self.lbl_numero_1.move(50, 50) self.lbl_numero_2 = QLabel('Número 2: ', self) self.lbl_numero_2.move(50, 100) self.txt_numero_1 = QLineEdit(self) self.txt_numero_1.setFixedWidth(100) self.txt_numero_1.move(150, 50) self.txt_numero_1.setValidator(QDoubleValidator()) self.txt_numero_2 = QLineEdit(self) self.txt_numero_2.setFixedWidth(100) self.txt_numero_2.move(150, 100) self.txt_numero_2.setValidator(QDoubleValidator()) self.btn_sumar = QPushButton('Sumar', self) self.btn_sumar.setFixedWidth(100) self.btn_sumar.move(100, 170) self.btn_sumar.clicked.connect(self.sumar) # Evento Click self.lbl_resultado = QLabel('Resultado: ', self) self.lbl_resultado.move(50, 250) self.lbl_resultado = QLabel(self) self.lbl_resultado.setFixedWidth(100) self.lbl_resultado.move(150, 250)
def setUpWindow(self): """Set up the dialog's widgets and layout.""" header_label = QLabel("""<p style='color:#65888C'> Welcome to Database Manager</p>""") header_label.setFont(QFont("Arial", 24)) header_label.setAlignment(Qt.AlignmentFlag.AlignCenter) self.info_label = QLabel("""<p style='color:#65888C'> Sign into your account.</p>""") self.info_label.setAlignment(Qt.AlignmentFlag.AlignHCenter) username_label = QLabel("Username:"******"Password:"******"Log In", QDialogButtonBox.ButtonRole.AcceptRole) button_box.accepted.connect(self.clickedLogInButton) log_in_grid = QGridLayout() log_in_grid.addWidget(header_label, 0, 0, 1, 3, Qt.AlignmentFlag.AlignCenter) log_in_grid.addWidget(self.info_label, 1, 0, 1, 3, Qt.AlignmentFlag.AlignCenter) log_in_grid.addWidget(username_label, 2, 0) log_in_grid.addWidget(self.username_line, 2, 1) log_in_grid.addWidget(password_label, 3, 0) log_in_grid.addWidget(self.password_line, 3, 1) log_in_grid.addWidget(button_box, 4, 1) self.setLayout(log_in_grid)
def initUI(self): self.setWindowIcon(QIcon(SRC_DIR + "desc.ico")) self.lb_name = QLabel() self.lb_name.setText("文件夹名:") self.lb_name.setAlignment(Qt.AlignmentFlag.AlignRight | Qt.AlignmentFlag.AlignTrailing | Qt.AlignmentFlag.AlignVCenter) self.tx_name = QLineEdit() self.lb_desc = QLabel() self.tx_desc = QTextEdit() self.lb_desc.setText("描 述:") self.lb_desc.setAlignment(Qt.AlignmentFlag.AlignRight | Qt.AlignmentFlag.AlignTrailing | Qt.AlignmentFlag.AlignVCenter) self.buttonBox = QDialogButtonBox() self.buttonBox.setOrientation(Qt.Orientation.Horizontal) self.buttonBox.setStandardButtons( QDialogButtonBox.StandardButton.Ok | QDialogButtonBox.StandardButton.Cancel) self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setText("确定") self.buttonBox.button( QDialogButtonBox.StandardButton.Cancel).setText("取消") self.grid = QGridLayout() self.grid.setSpacing(10) self.grid.addWidget(self.lb_name, 1, 0) self.grid.addWidget(self.tx_name, 1, 1) self.grid.addWidget(self.lb_desc, 2, 0) self.grid.addWidget(self.tx_desc, 2, 1, 5, 1) self.grid.addWidget(self.buttonBox, 7, 1, 1, 1) self.setLayout(self.grid) self.buttonBox.accepted.connect(self.btn_ok) self.buttonBox.accepted.connect(self.accept) self.buttonBox.rejected.connect(self.reject)
def __init__(self, parent, top): super(QWidget, self).__init__(parent) self.top = top hlayout = QHBoxLayout() self.layout = QGridLayout() hlayout.addLayout(self.layout) hlayout.setAlignment(hlayout, Qt.Alignment.AlignTop) self.setLayout(hlayout) self.row = 0 self.__addLabel__("Gateway Services") self.__addLabel__("Gateway Host Name/IP Address") self.gatewayHostName = QLineEdit(self) self.__addInput__(self.gatewayHostName) self.__addLabel__("Exercise Data Server Host Name/IP Address") self.productionEDS = QLineEdit(self) self.prodEnable = QRadioButton("Production") self.prodEnable.setChecked(True) self.prodEnable.toggled.connect(self.radioProdClicked) self.prodEnable.setStyleSheet("QRadioButton{ width: 100; }") self.__addInputAndRadio__(self.productionEDS, self.prodEnable) self.testEDS = QLineEdit(self) self.testEnable = QRadioButton("Test") self.testEnable.toggled.connect(self.radioTestClicked) self.testEnable.setStyleSheet("QRadioButton{ width: 100; }") self.__addInputAndRadio__(self.testEDS, self.testEnable) self.__addLabel__("Messaging Port") self.messagePort = QLineEdit("61616") self.__addInput__(self.messagePort)
def __init__(self): super().__init__() self.setWindowTitle("File Hash Checker") self.setGeometry(0, 0, 600, 300) self.labelFileDropper = FileDropper("Datei auswählen") #self.selectFileButton.clicked.connect(self.get_file_to_check) self.labelFileDropper.setAcceptDrops(True) self.labelFileDropper.setStyleSheet( "border: 1px solid black; border-radius: 15px; text-align: center; " "height: 200px") self.labelFileDropper.move(0, 0) self.labelFileDropper.resize(500, 150) self.labelMD5Hash = QLabel( "Bitte zu vergleichenden MD5 Hash eingeben:") self.textMD5Hash = QLineEdit() self.buttonCompareMD5 = QPushButton('MD5 Vergleichen') self.buttonCompareMD5.clicked.connect(self.compare_md5) self.labelIsSame = QLabel() layout = QVBoxLayout() layout.addWidget(self.labelFileDropper) layout.addWidget(self.labelMD5Hash) layout.addWidget(self.textMD5Hash) layout.addWidget(self.buttonCompareMD5) layout.addWidget(self.labelIsSame) self.setLayout(layout)
def __init__(self, parent=None): QWidget.__init__(self, parent) self.l = l = QFormLayout(self) self.username = u = QLineEdit(self) u.textChanged.connect(self.changed.emit) l.addRow(_('&Username:'******'Username for this account')) self.password = p = QLineEdit(self) l.addRow(_('&Password:'******'Password for this account')) p.textChanged.connect(self.changed.emit) p.setEchoMode(QLineEdit.EchoMode.Password) self.show_password = sp = QCheckBox(_('&Show password')) l.addWidget(sp) sp.toggled.connect(self.show_password_toggled) self.la = la = QLabel(_('&Notes:')) l.addRow(la) self.notes = n = QPlainTextEdit(self) la.setBuddy(n) n.textChanged.connect(self.changed.emit) l.addRow(n) self.autosubmit = asb = QCheckBox( _('&Auto login with these credentials'), self) l.addRow(asb) asb.stateChanged.connect(self.on_change) self.rb = b = QPushButton(_('&Delete this account')) b.clicked.connect(self.delete_requested.emit) l.addRow(b)
def accountCreationPageUI(self): layout = QFormLayout() self.accountCreationPage.nameInput = QLineEdit() layout.addRow("Name", self.accountCreationPage.nameInput) self.accountCreationPage.phoneNumberInput = QLineEdit() layout.addRow("Phone Number", self.accountCreationPage.phoneNumberInput) self.accountCreationPage.passwordInput = QLineEdit() layout.addRow("New Password", self.accountCreationPage.passwordInput) self.accountCreationPage.passwordConfirmInput = QLineEdit() layout.addRow("Confirm New Password", self.accountCreationPage.passwordConfirmInput) self.accountCreationPage.createAccountButton = QPushButton( "&Create Account") self.accountCreationPage.createAccountButton.clicked.connect( self.createAccount) self.accountCreationPage.finishCreatingAccountsButton = QPushButton( "&Done") self.accountCreationPage.finishCreatingAccountsButton.clicked.connect( self.goTo_PlayerAdmissionsPage) layout.addRow(self.accountCreationPage.finishCreatingAccountsButton, self.accountCreationPage.createAccountButton) self.accountCreationPage.setLayout(layout)
def initUI(self): self.setGeometry(self.xPos, self.yPos, self.width, self.height) self.vBoxLayout = QVBoxLayout() self.tagbox = TagBox() self.tagbox.addTag('Homelander') self.tagbox.addTag('Queen Maeve') self.tagbox.addTag('Black Noir') self.tagbox.addTag('Transluscent') self.tagbox.addTag('A-Train') self.tagbox.addTag('The Deep') self.vBoxLayout.addWidget(self.tagbox) self.tagEdit = QLineEdit() self.vBoxLayout.addWidget(self.tagEdit) self.addButton = QPushButton() self.addButton.setText('Add New Tag') self.addButton.clicked.connect(self.addNewTag) self.vBoxLayout.addWidget(self.addButton) self.centralWidget = QWidget(self) self.centralWidget.setLayout(self.vBoxLayout) self.setCentralWidget(self.centralWidget) self.show()
class SettingsDialog(QDialog): def __init__(self): """ Dialog to manage the settings of the application """ super().__init__() self.setWindowTitle("Settings") self.setFixedSize(310, 250) # Create the general settings widgets for managing the text color, # text alignment, and author of the app's content # NOTE: Altering the default CSS attributes, such as the color, of a # widget can change its appearance. Hence, the button may appear # rectangular depending upon your platform self.text_color_button = QPushButton() self.text_color_button.setStyleSheet( "background-color: #000000") # Black self.text_color_button.clicked.connect(self.selectTextColor) self.align_left = QRadioButton(text="Left") # Default self.align_left.setChecked(True) self.align_center = QRadioButton(text="Center") self.align_center.setChecked(False) self.align_right = QRadioButton(text="Right") self.align_right.setChecked(False) # Layout and container for alignment radio buttons align_v_box = QVBoxLayout() align_v_box.setContentsMargins(0, 5, 0, 0) align_v_box.addWidget(self.align_left) align_v_box.addWidget(self.align_center) align_v_box.addWidget(self.align_right) align_frame = QFrame() align_frame.setFrameShape(QFrame.Shape.NoFrame) align_frame.setLayout(align_v_box) self.author_name = QLineEdit() self.author_name.setMinimumWidth(160) self.button_box = QDialogButtonBox( QDialogButtonBox.StandardButtons.Ok | QDialogButtonBox.StandardButtons.Cancel) self.button_box.accepted.connect(self.accept) self.button_box.rejected.connect(self.reject) dialog_layout = QFormLayout() dialog_layout.addRow("<b>Text Color:</b>", self.text_color_button) dialog_layout.addRow(HorizontalSeparator()) dialog_layout.addRow("<b>Text Alignment:</b>", align_frame) dialog_layout.addRow(HorizontalSeparator()) dialog_layout.addRow("<b>Author:</b>", self.author_name) dialog_layout.addWidget(self.button_box) self.setLayout(dialog_layout) def selectTextColor(self): """Change the background color of the QPushButton to reflect the selected color. This is used to set the text color of the main window's QLineEdit.""" color = QColorDialog.getColor() # Returns QColor object # Use color.name() to get the color in the format "#RRGGBB" self.text_color_button.setStyleSheet( f"background-color: {color.name()}")
def initUI(self): title = QLabel('Title') author = QLabel('Author') review = QLabel('Review') titleEdit = QLineEdit() authorEdit = QLineEdit() reviewEdit = QTextEdit() grid = QGridLayout() grid.setSpacing(10) grid.addWidget(title, 1, 0) grid.addWidget(titleEdit, 1, 1) grid.addWidget(author, 2, 0) grid.addWidget(authorEdit, 2, 1) grid.addWidget(review, 3, 0) grid.addWidget(reviewEdit, 3, 1, 5, 1) self.setLayout(grid) self.setGeometry(300, 300, 350, 300) self.setWindowTitle('Review') self.show()
def initUi(self): self.setWindowTitle('Demo QLineEdit') self.setFixedSize(400, 400) self.txt_mensaje = QLineEdit(self) self.txt_mensaje.setFixedWidth(300) self.txt_mensaje.move(50, 150)
def __add_input_field(self): self.input = QLineEdit() # TODO: Fix the bottom dock. BottomDock thingy is incompatible with Qt6 self.input_dock.setAllowedAreas(Qt.DockWidgetArea.BottomDockWidgetArea | Qt.DockWidgetArea.TopDockWidgetArea) self.input_dock.setWidget(self.input) self.addDockWidget(Qt.DockWidgetArea.BottomDockWidgetArea, self.input_dock) self.input.returnPressed.connect(self.write_to_input_buffer)
def __init__(self, parent=None): #init methods runs every time, use for core app stuff) super(Window, self).__init__() #self.setWindowTitle("MorphoMetriX") #self.setGeometry(50, 50, 100, 200) #x,y,width,height #self.setStyleSheet("background-color: rgb(0,0,0)") #change color #self.setStyleSheet("font-color: rgb(0,0,0)") #change color self.label_id = QLabel("Image ID") self.id = QLineEdit() self.id.setText('0000') #Define custom attributes for pixel -> SI conversion self.label_foc = QLabel("Focal Length (mm):") self.focal = QLineEdit() self.focal.setText('50') self.label_alt = QLabel("Altitude (m):") self.altitude = QLineEdit() self.altitude.setText('50') self.label_pd = QLabel("Pixel Dimension (mm/pixel)") self.pixeldim = QLineEdit() self.pixeldim.setText('0.00391667') self.label_widths = QLabel("# Width Segments:") self.numwidths = QLineEdit() self.numwidths.setText('10') self.label_not = QLabel("Notes:") self.notes = QPlainTextEdit() # self.manual = QWebEngineView() #fpath = os.path.abspath('/Users/WalterTorres/Dropbox/KC_WT/MorphoMetrix/morphometrix/README.html') #webpage = QtCore.QUrl.fromLocalFile(fpath) # webpage = QtCore.QUrl('https://wingtorres.github.io/morphometrix/') # self.manual.setUrl(webpage) self.exit = QPushButton("Exit", self) self.exit.clicked.connect(self.close_application) self.grid = QGridLayout() self.grid.addWidget(self.label_id, 1, 0) self.grid.addWidget(self.id, 1, 1) self.grid.addWidget(self.label_foc, 2, 0) self.grid.addWidget(self.focal, 2, 1) self.grid.addWidget(self.label_alt, 3, 0) self.grid.addWidget(self.altitude, 3, 1) self.grid.addWidget(self.label_pd, 4, 0) self.grid.addWidget(self.pixeldim, 4, 1) self.grid.addWidget(self.label_widths, 5, 0) self.grid.addWidget(self.numwidths, 5, 1) self.grid.addWidget(self.label_not, 6, 0) self.grid.addWidget(self.notes, 6, 1) # self.grid.addWidget(self.manual, 8,0,1,4) self.grid.addWidget(self.exit, 7, 3) self.setLayout(self.grid)
def _createDisplay(self): """Create the display.""" # Create the display widget self.display = QLineEdit() # Set some display's properties self.display.setFixedHeight(35) self.display.setAlignment(Qt.AlignmentFlag.AlignRight) self.display.setReadOnly(True) # Add the display to the general layout self.generalLayout.addWidget(self.display)
def __init__(self, parent=None): QLineEdit.__init__(self, parent) self.setAttribute(Qt.WidgetAttribute.WA_MacShowFocusRect, False) self.setStyleSheet( 'QLineEdit { background: transparent; color: %s; selection-background-color: %s }' % ( color('status bar foreground', 'palette(window-text)'), color('status bar selection', 'palette(window-text)'), )) self.search_forward = True self.textEdited.connect(self.text_edited)
def __init__(self): super(MainWidget, self).__init__() self.resize(500, 600) self.setWindowTitle("喜马拉雅下载 by[Zero] " + __VERSION__) self.mainlayout = QVBoxLayout() self.setLayout(self.mainlayout) self.groupbox = QGroupBox("选择类型") self.groupbox.setFixedHeight(50) hlayout = QHBoxLayout(self.groupbox) self.signal_m4a = QRadioButton("单个下载") self.mut_m4a = QRadioButton("专辑下载") self.vip_signal_m4a = QRadioButton("VIP单个下载") self.vip_m4a = QRadioButton("VIP专辑下载") hlayout.addWidget(self.signal_m4a) hlayout.addWidget(self.mut_m4a) hlayout.addWidget(self.vip_signal_m4a) hlayout.addWidget(self.vip_m4a) self.mainlayout.addWidget(self.groupbox) frame01 = QFrame(self) child_layout = QVBoxLayout() print(self.width()) label01 = QLabel("链 接", self) label02 = QLabel("下载目录", self) self.url_lineedit = QLineEdit(self) self.dir_lineedit = QLineEdit(self) hlayout01 = QHBoxLayout() hlayout01.addWidget(label01, 1) hlayout01.addWidget(self.url_lineedit, 9) hlayout02 = QHBoxLayout() hlayout02.addWidget(label02, 1) hlayout02.addWidget(self.dir_lineedit, 9) child_layout.addLayout(hlayout01) child_layout.addLayout(hlayout02) child_layout.setContentsMargins( 5, 0, 5, 0) #(int left, int top, int right, int bottom) frame01.setLayout(child_layout) self.download_progressbar = QProgressBar() self.download_progressbar.setAlignment( QtCore.Qt.Alignment.AlignCenter) #文字居中 self.download_progressbar.setValue(88) self.download_btn = QPushButton("开始下载") self.show_plaintextedit = QPlainTextEdit() self.show_plaintextedit.setMinimumHeight(400) self.mainlayout.addWidget(frame01) self.mainlayout.addWidget(self.download_progressbar) self.mainlayout.addWidget(self.download_btn) self.mainlayout.addWidget(self.show_plaintextedit) self.mainlayout.addStretch() ### 设置stylesheet self.download_btn.setStyleSheet( 'QPushButton:pressed{ text-align: center;background-color:red;}')
def start(self): super().__init__() self.setWindowTitle("Enter your credentials") QBtn = QDialogButtonBox.StandardButton.Ok self.buttonBox = QDialogButtonBox(QBtn) self.buttonBox.accepted.connect(self.accept) self.buttonBox.rejected.connect(self.reject) self.layout = QFormLayout() self.layout.addRow('Username:'******'Password:'******'Hostname:', QLineEdit()) self.layout.addRow('Database:', QLineEdit()) self.layout.addWidget(self.buttonBox) self.setLayout(self.layout) self.exec() if QBtn == QDialogButtonBox.StandardButton.Ok: cred = { 'user': self.layout.itemAt(1).widget().text(), 'password': self.layout.itemAt(3).widget().text(), 'host': self.layout.itemAt(5).widget().text(), 'database': self.layout.itemAt(7).widget().text() } try: success = CONNECT(cred) env = dotenv.find_dotenv() dotenv.set_key(env, 'USER', cred['user']) dotenv.set_key(env, 'PASS', cred['password']) dotenv.set_key(env, 'HOST', cred['host']) dotenv.set_key(env, 'DATA', cred['database']) return success except (sql.errors.InterfaceError, ValueError): message = QMessageBox(self) message.setWindowTitle('Error') message.setText('The entered credentials are incorrect') message.setStandardButtons(QMessageBox.StandardButton.Ok) if message == QMessageBox.StandardButton.Ok: self.start()
def initUI(self): self.lbl = QLabel(self) qle = QLineEdit(self) qle.move(60, 100) self.lbl.move(60, 40) qle.textChanged[str].connect(self.onChanged) self.setGeometry(300, 300, 350, 250) self.setWindowTitle('QLineEdit') self.show()
def lockPageUI(self): layout = QFormLayout() self.lockPage.facilNameInput = QLineEdit() layout.addRow("Name", self.lockPage.facilNameInput) self.lockPage.facilPasswordInput = QLineEdit() layout.addRow("Password", self.lockPage.facilPasswordInput) self.lockPage.loginButton = QPushButton("&Login") self.lockPage.loginButton.clicked.connect(self.attemptLockFacilLogin) layout.addRow(self.lockPage.loginButton) self.lockPage.setLayout(layout)
class VentanaPrincipal(QMainWindow): def __init__(self): QMainWindow.__init__(self) self.initUi() def initUi(self): self.setWindowTitle('Demo QLineEdit') self.setFixedSize(400, 400) self.txt_mensaje = QLineEdit(self) self.txt_mensaje.setFixedWidth(300) self.txt_mensaje.move(50, 150)
def initUi(self): self.setWindowTitle('Demo Ventana de Saludo!!!') self.setFixedSize(400, 400) self.lbl_nombre = QLabel('Nombre: ', self) self.lbl_nombre.move(75, 50) self.txt_nombre = QLineEdit(self) self.txt_nombre.setFixedWidth(250) self.txt_nombre.move(75, 80) self.btn_saludar = QPushButton('Saludar', self) self.btn_saludar.setFixedWidth(250) self.btn_saludar.move(75, 120) self.btn_saludar.clicked.connect(self.mostrar_saludo)
def setup_ui(self): self.l = l = QFormLayout(self) l.setFieldGrowthPolicy( QFormLayout.FieldGrowthPolicy.ExpandingFieldsGrow) self.la = la = QLabel(self.msg) la.setMinimumWidth(450) la.setWordWrap(True) l.addRow(la) self.username = un = QLineEdit(self) l.addRow(_('&Username:'******'&Password:'******'&Show password'), self) l.addRow(c) c.toggled.connect(self.show_password_toggled) l.addRow(self.bb)
def __init__(self): super(Window, self).__init__() self.groupBox = QGroupBox( "What is your favorite programming Language ?") self.groupBox.setFont(QFont("Sanserif", 13)) self.lineEdit = QLineEdit() self.label = QLabel("You input string is :") self.title = " " self.left = 100 self.top = 200 self.width = 400 self.height = 300 self.InitWindow()
def __init__(self): super(MainUi, self).__init__() self.setFixedSize(600,500) self.setWindowTitle("妹子图爬虫工具 version: 1.0.0 ") self.download_progressbar = QProgressBar() self.download_progressbar.setAlignment(QtCore.Qt.Alignment.AlignCenter)#文字居中 self.download_progressbar.setStyleSheet(".QProgressBar::chunk { background-color: red;}")#背景 self.download_progressbar.setValue(100) label01 = QLabel("下载URL:") label02 = QLabel("下载目录:") self.url_input = QLineEdit() self.url_input.setText("https://www.mzitu.com/221746") self.url_input.setContentsMargins(0,0,0,0) self.download_dir = QLineEdit() self.download_dir.setContentsMargins(0,0,0,0) self.start_btn = QPushButton("开始爬虫") self.start_btn.setFixedHeight(50) self.start_btn.setContentsMargins(0,0,0,0) inputlayout = QGridLayout() inputlayout.addWidget(label01, 0, 0) #第0行 0列 inputlayout.addWidget(label02, 1, 0) inputlayout.addWidget(self.url_input, 0, 1) inputlayout.addWidget(self.download_dir, 1, 1) inputlayout.addWidget(self.start_btn, 0, 2, 2,1,QtCore.Qt.Alignment.AlignRight) #起始行,起始列, 占行数,占列数 inputlayout.setColumnStretch(0, 1) #设置每一列比例 inputlayout.setColumnStretch(1, 10) inputlayout.setColumnStretch(2, 1) vlayout = QVBoxLayout() vlayout.addLayout(inputlayout) vlayout.addWidget(self.download_progressbar) self.frame = QFrame() self.frame.setFixedHeight(400) vlayout.addWidget(self.frame) vlayout.addStretch() inputlayout.setContentsMargins(0,0,0,0) vlayout01 = QVBoxLayout() self.frame.setLayout(vlayout01) self.qtablewidget = QTableWidget(1,3) self.qtablewidget.setHorizontalHeaderLabels(['目录','下载图片总数目', '删除']) vlayout01.addWidget(self.qtablewidget) self.qtablewidget.setColumnWidth(0, 358) # 将第0列的单元格,设置成300宽度 self.qtablewidget.setColumnWidth(1, 100 ) # 将第0列的单元格,设置成50宽度 self.qtablewidget.verticalHeader().setVisible(False) #隐藏水平表头 #self.qtablewidget.setDisabled(True) #设置不可编辑 self.setLayout(vlayout) self.current_index = 0
def measure_angle(self): self.lea = QLineEdit(self) self.lea.move(130, 22) text, ok = QInputDialog.getText(self, 'Input Dialog', 'Angle name') if ok: self.lea.setText(str(text)) self.angleNames.append(self.lea.text()) QApplication.setOverrideCursor(QtCore.Qt.CrossCursor) #change cursor self.bezier.setEnabled(False) self.iw.measuring_angle = True self.iw._lastpos = None self.iw._thispos = None self.statusbar.showMessage('Click initial point for angle measurement') else: self.angleButton.setChecked(False)
class AttributeCreatorWidget(CustomScrollableListItem): def __init__(self, document_base_creator_widget) -> None: super(AttributeCreatorWidget, self).__init__(document_base_creator_widget) self.document_base_creator_widget = document_base_creator_widget self.setFixedHeight(40) self.setStyleSheet("background-color: white") self.layout = QHBoxLayout(self) self.layout.setContentsMargins(20, 0, 20, 0) self.layout.setSpacing(10) self.name = QLineEdit() self.name.setFont(CODE_FONT_BOLD) self.name.setStyleSheet("border: none") self.layout.addWidget(self.name) self.delete_button = QPushButton() self.delete_button.setIcon(QIcon("aset_ui/resources/trash.svg")) self.delete_button.setFlat(True) self.delete_button.clicked.connect(self._delete_button_clicked) self.layout.addWidget(self.delete_button) def update_item(self, item, params=None): self.name.setText(item) def _delete_button_clicked(self): self.document_base_creator_widget.delete_attribute(self.name.text()) def enable_input(self): self.delete_button.setEnabled(True) def disable_input(self): self.delete_button.setEnabled(False)
def setup_ui(self): self.l = l = QVBoxLayout(self) self.la = la = QLabel( _('Enter the master password for the password manager')) la.setWordWrap(True) l.addWidget(la) self.pw = pw = QLineEdit(self) pw.setEchoMode(QLineEdit.EchoMode.Password) l.addWidget(pw) self.showp = sp = QCheckBox(_('&Show password'), self) l.addWidget(sp) sp.toggled.connect(self.show_password_toggled) if self.create_password: self.la2 = la = QLabel(_('Confirm (re-enter) the password')) l.addWidget(la) self.confirm = c = QLineEdit(self) l.addWidget(c) l.addWidget(self.bb)
def loginPageUI(self): layout = QFormLayout() self.loginPage.nameInput = QLineEdit() layout.addRow("Name", self.loginPage.nameInput) self.loginPage.passwordInput = QLineEdit() layout.addRow("Password", self.loginPage.passwordInput) self.loginPage.loginButton = QPushButton("&Login") self.loginPage.loginButton.clicked.connect(self.attemptLogin) self.loginPage.abortLoginButton = QPushButton("&Back") self.loginPage.abortLoginButton.clicked.connect( self.goTo_PlayerAdmissionsPage) layout.addRow(self.loginPage.abortLoginButton, self.loginPage.loginButton) self.loginPage.setLayout(layout)
def __init__(self): super().__init__() self.setWindowTitle('my app') self.setWindowIcon(QIcon('python.ico')) self.resize(500, 350) # x, y layout = QVBoxLayout() self.setLayout(layout) # widgets self.inputField = QLineEdit() button = QPushButton('&say hello') button.clicked.connect(self.say_hello) self.output = QTextEdit() layout.addWidget(self.inputField) layout.addWidget(button) layout.addWidget(self.output)