Feb-03-2021, 08:49 PM
How you go about doing the "main" part depends on what "main" is doing. If main can be done quickly, you can put the main processing in a function and bind a control to call the function. If main takes a long time but can be broken up into little pieces of work you can implement main as a state machine and attach it to an event to be worked on whenever the GUI is not busy processing other events. If main is some a monolithic bunch of processing you might want to do main as a subprocess or do it in a separate thread. As Axel_Erfurt says, nobody can offer any useful suggestions without knowing what main does.