本文整理匯總了Python中PyQt5.QtWidgets.QLineEdit.resize方法的典型用法代碼示例。如果您正苦於以下問題:Python QLineEdit.resize方法的具體用法?Python QLineEdit.resize怎麽用?Python QLineEdit.resize使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類PyQt5.QtWidgets.QLineEdit
的用法示例。
在下文中一共展示了QLineEdit.resize方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: UIWindow
# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import resize [as 別名]
class UIWindow(QWidget):
def __init__(self, parent=None):
super(UIWindow, self).__init__(parent)
self.resize(QSize(600, 750))
self.ToolsBTN = QPushButton('Ok', self)
self.ToolsBTN.resize(100, 40)
self.ToolsBTN.move(200, 450)
self.dialog = QLabel(parent)
self.dialog.setText('Please enter your Email')
newfont = QtGui.QFont("Times", 15, QtGui.QFont.Bold)
self.dialog.setFont(newfont)
self.dialog.resize(250, 40)
self.dialog.move(50, 20)
self.dialog2 = QLabel(parent)
self.dialog2.setText('Complete!')
newfont = QtGui.QFont("Times", 15, QtGui.QFont.Bold)
self.dialog2.setFont(newfont)
self.dialog2.resize(100, 40)
self.dialog2.move(200, 400)
self.dialog2.setVisible(False)
self.mail = QLineEdit(parent)
self.mail.resize(150, 30)
self.mail.move(320, 22)
self.ToolsBTN.clicked.connect(self.savemail)
def savemail(self):
send_mail("[email protected]", self.mail.text(), 'sync', 'this email sent from best-sync group',"Expenses01.xlsx", 'smtp.gmail.com', 587)
self.dialog2.setVisible(True)
示例2: MyMainWindow
# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import resize [as 別名]
class MyMainWindow(QMainWindow):
def __init__(self):
super(QMainWindow, self).__init__()
self.title = 'PyQt5 textbox example'
self.left = 100
self.top = 100
self.width = 640
self.height = 480
self.init_ui()
def init_ui(self):
self.setWindowTitle(self.title)
self.setGeometry(self.left, self.top, self.width, self.height)
self.textbox = QLineEdit(self)
self.textbox.move(20, 20)
self.textbox.resize(280, 30)
button = QPushButton('Show Text', self)
button.move(20, 80)
button.clicked.connect(self.on_button_click)
def on_button_click(self):
text = self.textbox.text()
if text:
QMessageBox.information(self, 'Message - textbox example', 'You typed: ' + text, QMessageBox.Ok, QMessageBox.Ok)
else:
QMessageBox.warning(self, 'Message - textbox example', 'You have not typed anything!', QMessageBox.Ok, QMessageBox.Ok)
self.textbox.setText('')
示例3: App
# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import resize [as 別名]
class App(QMainWindow):
def __init__(self):
super().__init__()
self.title = 'PyQt5 textbox'
self.left = 10
self.top = 10
self.width = 400
self.height = 140
self.initUI()
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 button in the window
self.button = QPushButton('Show text', self)
self.button.move(20, 80)
# Connect button on function on click
self.button.clicked.connect(self.on_click)
self.show()
@pyqtSlot()
def on_click(self):
textboxValue = self.textbox.text()
QMessageBox.question(self, 'Message - python.org', 'You Typed: ' + textboxValue, QMessageBox.Ok, QMessageBox.Ok)
self.textbox.setText("")
示例4: __init_ui
# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import resize [as 別名]
def __init_ui(self):
self.setWindowTitle(self.title)
self.setGeometry(self.left, self.top, self.width, self.height)
edit_box = QLineEdit('Drag this', self)
edit_box.setDragEnabled(True)
edit_box.move(10, 10)
edit_box.resize(200, 32)
label = CustomLabel('Drop here.', self)
label.move(10, 50)
label.resize(200, 32)
示例5: __init__
# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import resize [as 別名]
def __init__(self):
super().__init__()
editBox = QLineEdit('Drag this', self)
editBox.setDragEnabled(True)
editBox.move(10, 10)
editBox.resize(100, 32)
button = CustomLabel('Drop here.', self)
button.move(130, 15)
self.show()
示例6: initUI
# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import resize [as 別名]
def initUI(self):
QToolTip.setFont(QFont('SansSerif', 10))
self.setToolTip('This is a <b>QWidget</b> widget')
self.tray_icon = SystemTrayIcon.SystemTrayIcon(QIcon('idea.png'), self)
self.tray_icon.show()
# self.setStylesheet("border-radius: 10px")
# self.autoFillBackground(True)
btn = QPushButton('Кнопка', self)
btn.setToolTip('This is a <b>QPushButton</b> widget')
btn.resize(btn.sizeHint())
btn.move(100, 10)
btn.clicked.connect(Windows.notif)
exit = QPushButton('Выход', self)
exit.resize(btn.sizeHint())
exit.move(10, 10)
exit.clicked.connect(QCoreApplication.instance().quit)
textSearch = QLineEdit(self)
textSearch.move(200, 10)
textSearch.resize(470, 26)
hbox = QHBoxLayout()
hbox.addStretch(1)
hbox.addWidget(btn)
hbox.addWidget(exit)
hbox.addWidget(textSearch)
self.setGeometry(1500, 400, 700, 47)
self.setWindowTitle('Tooltips')
self.setWindowFlags(Qt.FramelessWindowHint)
# self.tray_icon.showMessage(
# "Tray Program",
# "Application was minimized to Tray",
# QSystemTrayIcon.Information,
# 2000
# )
self.show()
示例7: Window
# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import resize [as 別名]
class Window(QDialog):
def __init__(self):
QDialog.__init__(self)
self.setWindowTitle('pyqt5界麵實時更新例子')
self.resize(400, 100)
self.input = QLineEdit(self)
self.input.resize(400, 100)
self.initUI()
def initUI(self):
# 創建線程
self.backend = BackendThread()
# 連接信號
self.backend.update_date.connect(self.handleDisplay)
# 開始線程
self.backend.start()
#將當前時間輸出到文本框
def handleDisplay(self, data):
self.input.setText(data)
示例8: App
# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import resize [as 別名]
class App(QMainWindow):
def __init__(self):
super().__init__()
self.title = 'GSEA'
self.left = 10
self.top = 10
self.width = 400
self.height = 200
self.initUI()
def initUI(self):
self.layout = QVBoxLayout()
self.setWindowTitle(self.title)
self.setGeometry(self.left, self.top, self.width, self.height)
self.textbox = QLineEdit(self)
self.textbox.move(20, 20)
self.textbox.resize(280,40)
self.textbox.setToolTip("Please enter GEO id")
self.textbox.resize(self.textbox.sizeHint())
self.textbox2 = QLineEdit(self)
self.textbox2.move(20, 90)
self.textbox2.resize(280,40)
self.textbox2.setToolTip("Please enter Gene list")
self.textbox2.resize(self.textbox2.sizeHint())
self.button = QPushButton('Get p_value', self)
self.button.move(20,150)
self.button.clicked.connect(self.on_click)
self.show()
def on_click(self):
self.geo_ID = self.textbox.text()
self.gene_list = self.textbox2.text().split()
QMessageBox.question(self, 'GSEA p_value', "p_value: " + GSEA(self.geo_ID,self.gene_list), QMessageBox.Ok, QMessageBox.Ok)
self.textbox.setText("")
示例9: MainWindow
# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import resize [as 別名]
class MainWindow(QMainWindow):
updGUI = pyqtSignal()
def __init__(self, parent=None):
super(MainWindow, self).__init__(parent)
self.sourceImage = 'lena.jpg'
self.imgW = ImageWindow(self)
self.imgW2 = ImageWindow(self)
self.imgW3 = ImageWindow(self)
self.imgW4 = ImageWindow(self)
self.imgW5 = ImageWindow(self)
self.setupUI()
def setupUI(self):
self.setFixedSize(950,550)
self.verticalLayoutWidget = QWidget(self)
self.verticalLayoutWidget.setObjectName("verticalLayoutWidget")
self.verticalLayoutWidget.setGeometry(QRect(20, 30, 900, 500))
self.hLayout = QHBoxLayout(self.verticalLayoutWidget)
self.leftLayout = QVBoxLayout()
self.toolsLayout = QVBoxLayout()
self.paramsLayout = QVBoxLayout()
self.imageLayout = QGridLayout()
self.btnLabel = QtWidgets.QLabel(self)
self.btnLabel.setText("Image:")
self.imgButton = QPushButton(self)
self.imgButton.setText("Browse...")
self.imgButton.move(20, 20)
self.imgButton.resize(20, 40)
self.hbtn = QHBoxLayout()
self.hbtn.addWidget(self.btnLabel)
self.hbtn.addWidget(self.imgButton)
self.leftLayout.addLayout(self.hbtn)
self.toolBox = QGroupBox("Filters and tools")
self.paramBox = QGroupBox("Parametets")
self.leftLayout.addWidget(self.toolBox)
self.leftLayout.addWidget(self.paramBox)
self.hLayout.addLayout(self.leftLayout)
self.hLayout.addLayout(self.imageLayout)
# ---------------- RADIO BUTTONS ------------------------
self.low_pass_radio_button = QtWidgets.QRadioButton(self)
self.low_pass_radio_button.setText("Butterworth LPF")
self.high_pass_radio_button = QtWidgets.QRadioButton(self)
self.high_pass_radio_button.setText("Butterworth HPF")
self.sobel_radio_button = QtWidgets.QRadioButton(self)
self.sobel_radio_button.setText("Sobel Filter")
self.dct_radio_button = QtWidgets.QRadioButton(self)
self.dct_radio_button.setText("DCT compression")
#self.low_pass_radio_button.setChecked(True)
# ---------------- PARAMETERS ------------------------
self.frecLabel = QtWidgets.QLabel(self)
self.frecLabel.setText("Frec.")
self.cutFrec = QLineEdit(self)
self.cutFrec.setText("20")
self.cutFrec.move(20, 20)
self.cutFrec.resize(20, 40)
self.hFrec = QHBoxLayout()
self.hFrec.addWidget(self.frecLabel)
self.hFrec.addWidget(self.cutFrec)
self.orderLabel = QtWidgets.QLabel(self)
self.orderLabel.setText("Order (n)")
self.order = QLineEdit(self)
self.order.setText("1")
self.order.move(20, 20)
self.order.resize(20, 40)
self.horder = QHBoxLayout()
self.horder.addWidget(self.orderLabel)
self.horder.addWidget(self.order)
self.dctBox = QGroupBox("DCT")
layout = QVBoxLayout()
self.b1 = QCheckBox("Compression 1/64")
self.b1.setChecked(True)
self.b1.stateChanged.connect(lambda: self.btnstate(self.b1))
self.b2 = QCheckBox("Compression 3/64")
self.b2.toggled.connect(lambda: self.btnstate(self.b2))
self.b3 = QCheckBox("Compression 3/64")
self.b3.toggled.connect(lambda: self.btnstate(self.b3))
self.b4 = QCheckBox("Compression 6/64")
self.b4.toggled.connect(lambda: self.btnstate(self.b4))
self.b5 = QCheckBox("Compression 10/64")
self.b5.toggled.connect(lambda: self.btnstate(self.b5))
self.b6 = QCheckBox("Compression 15/64")
self.b6.toggled.connect(lambda: self.btnstate(self.b6))
self.b7 = QCheckBox("Compression 21/64")
self.b7.toggled.connect(lambda: self.btnstate(self.b7))
#.........這裏部分代碼省略.........
示例10: MyTableWidget
# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import resize [as 別名]
class MyTableWidget(QWidget):
def __init__(self, parent):
super(QWidget, self).__init__(parent)
self.layout = QVBoxLayout(self)
# Make QtableWidget
self.tableWidget = QTableWidget()
self.tableWidget.move(0,0)
self.tableWidget.doubleClicked.connect(self.on_click)
# Initialize tab screen
self.tabs = QTabWidget()
self.tab1 = QWidget()
self.tab2 = QWidget()
self.tab3 = QWidget()
self.tabs.resize(840,640)
# Add tabs
self.tabs.addTab(self.tab1,"Scrapping")
self.tabs.addTab(self.tableWidget,"View")
self.tabs.addTab(self.tab3, "Urls")
# Create first tab
self.tab1.layout = QVBoxLayout(self)
self.pushButton1 = QPushButton("Search")
self.pushButton1.clicked.connect(self.on_click_search)
# Make textbox
self.textbox = QLineEdit(self)
self.textbox.setText("https://en.wikipedia.org/wiki/Physics")
self.textbox.resize(280,40)
self.textbox.move(0,0)
self.textbox.setMaximumSize(800,80)
# Adding textbox and pushbutton
self.tab1.layout.addWidget(self.textbox)
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)
@pyqtSlot()
def on_click(self):
print("\n")
for currentQTableWidgetItem in self.tableWidget.selectedItems():
print(currentQTableWidgetItem.row(), currentQTableWidgetItem.column(), currentQTableWidgetItem.text())
def on_click_search(self):
"""
This is the button in tab 1 that will cause the list to vew the output.txt file and create a table of it in
tab 2.
"""
link = self.textbox.text()
if "http" in link:
scrapfromlink(self, link)
else:
scrapfromfile(self, link)
示例11: Example
# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import resize [as 別名]
class Example(QWidget):
def __init__(self):
super(Example, self).__init__()
self.initUI()
def initUI(self):
input_label = QLabel("Select file path", self)
input_label.move(50, 25)
self.input_filepath = QLineEdit(self)
self.input_filepath.move(50, 50)
self.input_filepath.setReadOnly(True)
self.input_filepath.resize(225, 20)
btn_upload = QPushButton('Select', self)
btn_upload.move(285, 45)
btn_upload.clicked.connect(self.handle_upload)
input_label = QLabel("Insert your password", self)
input_label.move(50, 80)
self.input_pwd = QLineEdit(self)
self.input_pwd.setEchoMode(QLineEdit.Password)
self.input_pwd.move(50, 105)
self.input_pwd.resize(225, 20)
btn = QPushButton('Encryption', self)
btn.move(175, 150)
btn.clicked.connect(self.handle_encode)
btn = QPushButton('Decryption', self)
btn.clicked.connect(self.handle_decode)
btn.move(50, 150)
btn = QPushButton('Info', self)
btn.clicked.connect(self.handle_info)
btn.move(300, 150)
self.setGeometry(500, 500, 400, 220)
self.setWindowTitle('Code')
self.show()
def validate_inputs(self):
if not self.input_filepath.text() or not self.input_pwd.text():
msg = QMessageBox(self)
msg.setIcon(QMessageBox.Warning)
msg.setText("You should provide file path and password.")
msg.setWindowTitle("Validation")
msg.exec_()
return False
return True
def handle_encode(self):
if self.validate_inputs():
enc = Encryption(
self.input_filepath.text(),
self.input_pwd.text()
)
enc.encode()
self.input_pwd.setText("")
self.input_filepath.setText("")
msg = QMessageBox(self)
msg.setIcon(QMessageBox.Information)
msg.setText("File encrypted")
msg.setWindowTitle("Encryption")
msg.exec_()
def handle_decode(self):
if self.validate_inputs():
enc = Encryption(
self.input_filepath.text(),
self.input_pwd.text()
)
enc.decode()
self.input_pwd.setText("")
self.input_filepath.setText("")
msg = QMessageBox(self)
msg.setIcon(QMessageBox.Information)
msg.setText("File decrypted")
msg.setWindowTitle("Decryption")
msg.exec_()
def handle_info(self):
msg = QMessageBox(self)
msg.setIcon(QMessageBox.Information)
msg.setText(
"1. Decoded or Encoded file is saved in the same directory as you select file.\n"
"2. Newly created file has '-decoded' or '-encoded' prefix.\n"
"3. Key should be non empty ascii value.\n"
)
msg.setWindowTitle("Info")
msg.exec_()
#.........這裏部分代碼省略.........
示例12: Sample
# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import resize [as 別名]
class Sample (QMainWindow):
def __init__ (self):
super().__init__()
self.title = "SWITCH - Get NREL Data"
self.width = 430
self.height = 380
self.initUI()
def initUI (self):
# Main Window
self.setGeometry(300, 300, self.width, self.height)
self.setWindowTitle(self.title)
# self.setWindowIco(QIcon(<path>))
# NREL
label1 = QLabel('Fill in the following info. to start pulling data from NREL', self)
label1.move (35,20)
label1.resize(350,20)
# Name
labelName = QLabel('Name: ', self)
labelName.move(20, 55)
self.textboxName = QLineEdit (self)
self.textboxName.resize(340,25)
self.textboxName.move(65, 55)
# Reason for use
labelReason = QLabel('Reason for use: ', self)
labelReason.move(20, 90)
self.textboxReason = QLineEdit (self)
self.textboxReason.resize(280, 25)
self.textboxReason.move(125, 90)
# Email
labelEmail = QLabel('User Email: ', self)
labelEmail.move(20, 125)
self.textboxEmail = QLineEdit (self)
self.textboxEmail.resize(310,25)
self.textboxEmail.move(95, 125)
# Time interval (in minutes)
labelInterval = QLabel('Interval (mins): ', self)
labelInterval.move(20, 160)
self.textboxInterval = QLineEdit (self)
self.textboxInterval.resize(280, 25)
self.textboxInterval.move(125, 160)
# Affiliation
labelAffiliation = QLabel('Affiliation: ', self)
labelAffiliation.move(20, 195)
self.textboxAffiliation = QLineEdit (self)
self.textboxAffiliation.resize(310, 25)
self.textboxAffiliation.move(95, 195)
# API Key
labelAPI = QLabel('API Key: ', self)
labelAPI.move(20, 230)
self.textboxAPI = QLineEdit (self)
self.textboxAPI.resize(320, 25)
self.textboxAPI.move(85, 230)
# Data Year
labelYear = QLabel('Year: ', self)
labelYear.move(20, 265)
self.textboxYear = QLineEdit (self)
self.textboxYear.resize(340, 25)
self.textboxYear.move(65, 265)
# Pull Data Button
pullDataBttn = QPushButton('Pull Data From NREL', self)
pullDataBttn.move(120, 300)
pullDataBttn.resize(180, 25)
pullDataBttn.clicked.connect(self.pullDataNREL)
self.show()
@pyqtSlot()
def pullDataNREL (self):
missingD = self.checkForMissingInfo()
print (self.textboxName.text())
print (self.textboxEmail.text())
print (self.textboxReason.text())
print (self.textboxInterval.text())
print (self.textboxAffiliation.text())
print (self.textboxAPI.text())
print (self.textboxYear.text())
# Check for missing info.
if len(missingD) != 0:
QMessageBox.critical(self, "Missing information", "The following info. is missing: " + missingD, QMessageBox.Ok, QMessageBox.Ok)
return
self.meshFile = QFileDialog.getOpenFileName(self, 'Select Mesh File (.csv)', '/home')
self.savingDirectory = QFileDialog.getExistingDirectory(self, 'Select Saving Directory', '/home')
# Check that mesh file path isn't empty.
if len(self.meshFile) == 0:
QMessageBox.critical(self, "Missing Mesh File", "Please select a mesh file.", QMessageBox.Ok, QMessageBox.Ok)
#.........這裏部分代碼省略.........
示例13: ImePanel
# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import resize [as 別名]
class ImePanel(QWidget):
def __init__(self, inputMethodManager):
super().__init__()
self.imm = inputMethodManager
self.qLineImmDict = {}
self.initUI()
def getIMM(self):
return self.imm
def initUI(self):
self.resize(800, 600)
vbox = QVBoxLayout()
hbox = QHBoxLayout()
subvbox = QVBoxLayout()
subhbox = QHBoxLayout()
label = QLabel('當前狀態:', self)
subhbox.addWidget(label)
self.stateNameEditBox = QLineEdit(self)
self.stateNameEditBox.setReadOnly(True)
subhbox.addWidget(self.stateNameEditBox)
subhbox.setStretchFactor(self.stateNameEditBox, 2)
self.qLineImmDict[self.stateNameEditBox] = 'currStateName'
subvbox.addLayout(subhbox)
subhbox = QHBoxLayout()
label = QLabel('光標位置:', self)
subhbox.addWidget(label)
self.cursorPosEditBox = QLineEdit(self)
self.cursorPosEditBox.setReadOnly(True)
self.cursorPosEditBox.resize(100, 30)
subhbox.addWidget(self.cursorPosEditBox)
subvbox.addLayout(subhbox)
self.qLineImmDict[self.cursorPosEditBox] = 'cursorPos'
subhbox = QHBoxLayout()
label = QLabel('上屏串:', self)
subhbox.addWidget(label)
self.completedEditBox = QLineEdit(self)
self.completedEditBox.setReadOnly(True)
subhbox.addWidget(self.completedEditBox)
subvbox.addLayout(subhbox) # 行---------------------
self.qLineImmDict[self.completedEditBox] = 'Completed'
subhbox = QHBoxLayout()
label = QLabel('輸入串:', self)
subhbox.addWidget(label)
self.compositionEditBox = QLineEdit(self)
self.compositionEditBox.setReadOnly(True)
subhbox.addWidget(self.compositionEditBox)
self.qLineImmDict[self.compositionEditBox] = 'Composition'
subvbox.addLayout(subhbox)
subhbox = QHBoxLayout()
label = QLabel('輸入串顯示為:', self)
subhbox.addWidget(label)
self.compDisplayEditBox = QLineEdit(self)
self.compDisplayEditBox.setReadOnly(True)
subhbox.addWidget(self.compDisplayEditBox)
subvbox.addLayout(subhbox) # 行---------------------
self.qLineImmDict[self.compDisplayEditBox] = 'CompDisplay'
hbox.addLayout(subvbox)
subvbox = QVBoxLayout()
label = QLabel('候選串', self)
subvbox.addWidget(label)
self.candList = QListWidget(self)
subvbox.addWidget(self.candList)
hbox.addLayout(subvbox)
vbox.addLayout(hbox)
hbox = QHBoxLayout()
label = QLabel('在此輸入:', self)
hbox.addWidget(label)
self.editorBox = QLineEdit4Ime(self.getIMM(), self)
hbox.addWidget(self.editorBox)
vbox.addLayout(hbox) # 行---------------------
vbox.addStretch(1)
self.setLayout(vbox)
self.show()
def ImeKeyPressEvent(self):
for k, v in self.qLineImmDict.items():
if type(self.getIMM().GetCoreData(v)) == 'str':
k.setText(self.getIMM().GetCoreData(v))
else:
k.setText(str(self.getIMM().GetCoreData(v)))
self.candList.clear()
for i in self.getIMM().GetCoreData('Candidates'):
self.candList.addItem(i)
示例14: SafeB
# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import resize [as 別名]
class SafeB(QWidget):
def __init__(self):
super().__init__()
self.setAcceptDrops(True)
self.initUI()
def initUI(self):
self.center()
self.setFixedSize(435, 400)
self.setWindowTitle('SafeB')
self.setWindowIcon(QIcon('logo.png'))
# Add LineEdit for Puth
self.line_edit = QLineEdit(self)
self.line_edit.setReadOnly(True)
self.line_edit.resize(250, 23)
self.line_edit.move(5, 5)
self.line_edit.setText('Path to file')
self.line_edit.setStyleSheet("color: rgb(167, 167, 167);")
self.line_edit.setAcceptDrops(True)
self.line_edit.textChanged.connect(self.onChangedPath)
self.radio1 = QRadioButton(self)
self.radio1.setText('one image')
self.radio1.move(262, 37)
self.radio1.setChecked(True)
config.rad1 = self.radio1
self.radio2 = QRadioButton(self)
self.radio2.setText('few images')
self.radio2.move(340, 37)
config.rad2 = self.radio2
# Add LineEdit for Username
self.username = QLineEdit(self)
self.username.resize(250, 23)
self.username.move(5, 33)
self.username.setText('Username')
self.username.setStyleSheet("color: rgb(167, 167, 167);")
self.username.textChanged.connect(self.onChanged2)
self.username.mousePressEvent = lambda _: \
self.username.selectAll()
config.usern = self.username
# Add LineEdit for Password
self.password = QLineEdit(self)
self.password.resize(250, 23)
self.password.move(5, 61)
self.password.setText('Password')
self.password.setStyleSheet("color: rgb(167, 167, 167);")
self.password.textChanged.connect(self.onChanged)
self.password.mousePressEvent = lambda _: \
self.password.selectAll()
config.pwd = self.password
# Add result textline
self.resultText = QLabel(self)
self.resultText.move(262, 50) #262
self.resultText.resize(200, 46)
self.resultText.setText('Score: ')
self.resultText.setStyleSheet("color: rgb(167, 167, 167);")
config.res = self.resultText
# Add LineEdit for classifier_ids
self.classifier_ids = QLineEdit(self)
self.classifier_ids.resize(250, 23)
self.classifier_ids.move(5, 89)
self.classifier_ids.setText('Classifier_ids')
self.classifier_ids.setStyleSheet("color: rgb(167, 167, 167);")
self.classifier_ids.textChanged.connect(self.onChanged3)
self.classifier_ids.mousePressEvent = lambda _: \
self.classifier_ids.selectAll()
config.c_id = self.classifier_ids
# image for send
self.pic = QLabel(self)
self.pic.resize(567, 278)
self.pic.move(5, 117)
config.pic = self.pic
# Add AddButton to type the Puth
self.btn_add = QPushButton('Add', self)
self.btn_add.resize(self.btn_add.sizeHint())
self.btn_add.move(260, 5)
self.btn_add.clicked.connect(self.showDialog)
config.addB = self.btn_add
# Add SendButton to send a picture
self.btn_send = QPushButton('Send', self)
self.btn_send.resize(self.btn_send.sizeHint())
self.btn_send.move(340, 5)
self.btn_send.clicked.connect(self.sendPic)
config.sendB = self.btn_send
self.show()
def showDialog(self):
if self.radio1.isChecked():
path = QFileDialog.getOpenFileName()
#.........這裏部分代碼省略.........
示例15: initUI
# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import resize [as 別名]
def initUI(self):
label_config = QLabel('Build config file', self)
label_config.move(20, 20)
text_edit_config = QLineEdit(self)
text_edit_config.move(20, 40)
text_edit_config.resize(420, 20)
button_config = QPushButton(self)
button_config.setIcon(QIcon(ICON_FILE))
button_config.move(450, 40)
button_config.resize(20, 20)
button_config.clicked.connect(lambda x: self.show_file_choose_dialog(text_edit_config.setText))
label_sdk = QLabel('SDK path', self)
label_sdk.move(20, 70)
text_edit_sdk = QLineEdit(self)
text_edit_sdk.move(20, 90)
text_edit_sdk.resize(420, 20)
if os.environ.get('ANDROID_HOME'):
text_edit_sdk.setText(os.environ['ANDROID_HOME'])
button_sdk = QPushButton(self)
button_sdk.setIcon(QIcon(ICON_FILE))
button_sdk.move(450, 90)
button_sdk.resize(20, 20)
button_sdk.clicked.connect(lambda x: self.show_folder_choose_dialog(text_edit_sdk.setText))
label_keystore = QLabel('Keystore file', self)
label_keystore.move(20, 120)
text_edit_keystore = QLineEdit(self)
text_edit_keystore.move(20, 140)
text_edit_keystore.resize(420, 20)
button_keystore = QPushButton(self)
button_keystore.setIcon(QIcon(ICON_FILE))
button_keystore.move(450, 140)
button_keystore.resize(20, 20)
button_keystore.clicked.connect(lambda x: self.show_file_choose_dialog(text_edit_keystore.setText))
label_alias = QLabel('Keystore alias', self)
label_alias.move(20, 170)
text_edit_alias = QLineEdit(self)
text_edit_alias.move(20, 190)
text_edit_alias.resize(420, 20)
label_password = QLabel('Keystore password', self)
label_password.move(20, 220)
text_edit_password = QLineEdit(self)
text_edit_password.move(20, 240)
text_edit_password.resize(420, 20)
label_alias_password = QLabel('Keystore alias password', self)
label_alias_password.move(20, 270)
text_edit_alias_password = QLineEdit(self)
text_edit_alias_password.move(20, 290)
text_edit_alias_password.resize(420, 20)
label_template = QLabel('Template android project path', self)
label_template.move(20, 320)
text_edit_template = QLineEdit(self)
text_edit_template.move(20, 340)
text_edit_template.resize(420, 20)
button_template = QPushButton(self)
button_template.setIcon(QIcon(ICON_FILE))
button_template.move(450, 340)
button_template.resize(20, 20)
button_template.clicked.connect(lambda x: self.show_folder_choose_dialog(text_edit_template.setText))
ok_button = QPushButton('OK', self)
ok_button.move(400, 450)
ok_button.clicked.connect(
lambda x: self.ok_click(text_edit_config.text(), text_edit_sdk.text(), text_edit_keystore.text(),
text_edit_alias.text(), text_edit_password.text(), text_edit_alias_password.text(),
text_edit_template.text()))
self.setGeometry(300, 300, 500, 500)
self.setWindowTitle('Ubiq android build setup')
self.setWindowIcon(QIcon('web.png'))
self.show()