What I want to do is to make some part of the code in a class of my programm to wait for sometime, but my problem is that the way I am trying to it makes my GUI to stuck. I mean, pressing a button i make my program to wait for sometime, while my program is waiting i press a button, the button is pressed but after that if i try to press any other button while the program is still waiting i can’t, the first button i pressed seems to be pressed and the other button can’t be pressed although the program does what I want to do(accepts all the commands) the only problem is that my GUI is locked.
Share
You need to use multiple threads. Any “work” that needs to be done that may take any significant / noticeable amount of time needs to be done in its own thread. (This certainly includes any code where you are calling
sleep.)Here are 3 good references: