K
K
k0r0g2021-04-18 20:29:02
Python
k0r0g, 2021-04-18 20:29:02

How to wait for an event from the second form?

Hello.
I need to get the date from the user. You need to do this in the middle of a function. Unfortunately, there is no such dialog in QInputDialog.
I created a second form and decided that I would call it.
I wrote something like this in the function

# вызывает форму
self.dialog.show()
# ждёт, пока в поле формы появятся данные, затем прерывает ожидание
while True:
      if len(self.dialog.result) != 0:
           break
      time.sleep(0.3)
# получаю введённые данные
data = self.dialog.result


But, unfortunately, the form appears all white, there is nothing on it.
What is the problem here? Maybe there is a smarter way to wait for input?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
M
m0nym, 2018-07-23
@8toni8

"Control Panel" / "Select Default Applications for File Types"
Must be set for .py - python.exe or pythonw.exe

S
Sergey Passat, 2018-07-23
@Executicus

under what you launch dear. (Linux, Windows, IOS, you can still click it on our Mac or Steve Jobs system) this dude is important and it’s also important under which Python code 2 or 3 is written, I’m not an arch-coco pro, but I also do Python (a little bit), or describe what this program should do, maybe the code is written for the specifics of the prog machine, or the interpreter doesn’t work for you, or the libraries don’t work (or they don’t exist in general) if he didn’t compile it into EXE, that is, there is little information from you for you people on the toaster helped more specifically, add more information in the question people will help you

S
Sergey Gornostaev, 2021-04-18
@k0r0g

GUI events are handled by an infinite loop that starts when you call app.exec_()it. It cannot be stopped or the application will freeze, and the infinite loop does just that.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question