I'm using Tkinter with some buttons, sliders and such to make adjustment of the hardware to set fwd, stop, reverse, and adjust rpm of my motors. That seems ok, a callback function can access and manipulate the io. However, I'm a bit befudddled on how the rest of the system is to be situated. For example, two other I/O lines---as soon as both go high twice, another output to control a relay should activate, until either pin goes low (then the relay goes off). Another pin should read a limit switch and kill motor power & light an led as soon as it is detected (within a millisecond or hopefully sooner). I'm not sure where this code goes, since it has little or nothing to do with the gui itself. Ideally the gui's user's touches will not slow down these responses (so scrolling a slider won't delay the limit switch response)...but even some delay is ok for starters.
Are there any ideas or tutorials showing how to interface the gui with the hardware to do these kinds of things?