Where should that input come from? Do you want to retrieve the text that user has entered into some widget?
In general it is a bad idea to have long loop in event-based application.
Where should that input come from? Do you want to retrieve the text that user has entered into some widget?
In general it is a bad idea to have long loop in event-based application.
It is not a long loop.I revised the codes above.I ask a word to the user.If he makes a mistake the first letter of the answer reveals.But here because ı couldnot take another input from user the loop continues and reveals all the letters.I want it to reveal the letters one by one after the user enters his answer.
I take the input from user by line edit.
In that case you have to connect to the QLineEdit::textChanged() or some other QLineEdit signal and get rid of that loop.
I am not so good at pyqt.Can you give me an example on how to use it?
See this: http://zetcode.com/tutorials/pyqt4/widgets. It shows the typical way of doing things in Qt. In the Checkbox example you have a changeTitle() slot that is invoked every time the user clicks the check box. You don't need any loops to read data from the user -- the data will be delivered to you.
If you make a loop in your application, the event loop inside Qt won't run and Qt won't be able to redraw widgets and receive input from the user. So basically your application should only react to signals and events, instead of enforcing the program flow. Of course you can have loops in your code, but they should be short or the application will become unresponsive*.
The whole tutorial is here: http://zetcode.com/tutorials/pyqt4/
* You can use QCoreApplication::processEvents() to avoid this, but you should do that only as the last resort.
Thank you very much...
Bookmarks