Answer the question
In order to leave comments, you need to log in
How to get information from a dialog box?
Good afternoon everyone.
I, as always, with questions)
Guys, please tell me how to make the dialog box return the entered information?
I'm doing this right now:
def build_exel_registration(self):
info = ExelInfo() # Создаю экземпляр диалогового окна
info.exec() # Ставлю этот скрипт на паузу (Не понимаю как это работает)
if info.ok: # Смотрю переменную диалогового окна, проверяя нажал кнопку ok или cancel
name = info.name.text() # Беру имя из строки ввода
# класс диалогового окна
class ExelInfo(QDialog, exel_info_class):
def __init__(self, *args):
super(ExelInfo, self).__init__()
self.setupUi(self)
self.setModal(True)
self.setWindowIcon(QIcon(getcwd() + "/images/icon.ico"))
self.show()
def accept(self): # Если нажата кнопка Ok
self.ok = True
self.close()
def rect(self): # Если нажата кнопка cancel
self.ok = False
self.close()
name = ExelInfo()
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question