Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
asyncio semaphore problem
#5
Lets say your program needs to do A, B, C and D. To do C you need to present a dialog for input. You want to draw the dialog after B, wait for the user to respond, then continue on doing C and D. What I would do is call the dialog and end the thread of execution. Then I would have the dialog call a function to C and D.

As a more concrete example, let's say I want to open a file in my text editor program. Clicking on the File->Open menu option draws a file selection dialog. Once the dialog is draw, the code associated with asking to open a file is complete. The user can select a file, or close the dialog, or go get some coffee and not do anything for an hour. To the program it makes no difference. Nobody is waiting and there is no expectation. What the user does next will direct what the program does. The code to be executed is tied to the user action, not the other way around. If the user selects a file, the dialog callback will open the file and load the text into the editor. If the user closes the file dialog without making a selection, not only does the program not load the file, but the program doesn't even know there was an expectation of opening the file.
Reply


Messages In This Thread
asyncio semaphore problem - by gw1500se - May-28-2020, 07:01 PM
RE: asyncio semaphore problem - by deanhystad - May-28-2020, 10:26 PM
RE: asyncio semaphore problem - by gw1500se - May-29-2020, 12:37 PM
RE: asyncio semaphore problem - by gw1500se - May-29-2020, 01:48 PM
RE: asyncio semaphore problem - by deanhystad - May-29-2020, 03:09 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020