I have a class that draws a GUI, using gtk.
Clicking a button will call a method that will run some external
programs.
But the GUI may not redraw in the meantime.
One solution may be to use threads. This example creates a thread
outside the GUI class and starts it before calling gtk.main().
How do I make a thread outside the GUI class detect a button click event and call the
appropriate method?
You don’t need another thread to launch an external program, you can use Gtk’s idle loop. Here’s some pieces of program I wrote to do just that. It had to read the stdout of the program to show parts of it on the GUI as well, so I left that in there. The variable “job_aborted” is tied to an “Abort” button, that allows for early termination.