Answer the question
In order to leave comments, you need to log in
How to get value from input and radiobuttonn pyqt5?
import sys
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_Dialog(object):
def setupUi(self, Dialog):
Dialog.setObjectName("Parser for id")
Dialog.resize(240, 101)
Dialog.setMaximumSize(QtCore.QSize(240, 16777215))
self.pushButton = QtWidgets.QPushButton(Dialog)
self.pushButton.setGeometry(QtCore.QRect(160, 30, 81, 21))
button = self.pushButton.setObjectName("pushButton")
self.radioButton = QtWidgets.QRadioButton(Dialog)
self.radioButton.setGeometry(QtCore.QRect(40, 60, 61, 21))
self.radioButton.setObjectName("radioButton")
self.radioButton_2 = QtWidgets.QRadioButton(Dialog)
self.radioButton_2.setGeometry(QtCore.QRect(80, 60, 61, 21))
self.radioButton_2.setObjectName("radioButton_2")
self.lineEdit = QtWidgets.QLineEdit(Dialog)
self.lineEdit.setGeometry(QtCore.QRect(50, 30, 111, 21))
self.lineEdit.setObjectName("lineEdit")
self.label = QtWidgets.QLabel(Dialog)
self.label.setGeometry(QtCore.QRect(0, 26, 61, 31))
self.label.setObjectName("label")
self.label_2 = QtWidgets.QLabel(Dialog)
self.label_2.setGeometry(QtCore.QRect(0, 0, 241, 31))
self.label_2.setObjectName("label_2")
self.button.clicked.connect(self.clicked)
self.retranslateUi(Dialog)
QtCore.QMetaObject.connectSlotsByName(Dialog)
def clicked(self):
# надо сделать чек radibutton(если можно пример с if) и получить то, что написано в input
def retranslateUi(self, Dialog):
_translate = QtCore.QCoreApplication.translate
Dialog.setWindowTitle(_translate("Dialog", "Parser For id"))
self.pushButton.setText(_translate("Dialog", "Поиск"))
self.radioButton.setText(_translate("Dialog", "VK"))
self.radioButton_2.setText(_translate("Dialog", "OK"))
self.label.setText(_translate("Dialog", "<html><head/><body><p align=\"center\"><span style=\" font-size:10pt;\">ID:</span></p></body></html>"))
self.label_2.setText(_translate("Dialog", "<html><head/><body><p align=\"center\">Введите screenname или ID</p></body></html>"))
class MainWindow(QtWidgets.QMainWindow, Ui_Dialog):
def __init__(self, *args, obj=None, **kwargs):
super(MainWindow, self).__init__(*args, **kwargs)
self.setupUi(self)
app = QtWidgets.QApplication(sys.argv)
window = MainWindow()
window.show()
app.exec()
Answer the question
In order to leave comments, you need to log in
self.lineEdit.text()
- getting value from input, where lineEdit is your input variable
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question