widgets.program_run = nf.makewidget(root_window, Button, ".toolbar.program_run") widgets.program_pause = nf.makewidget(root_window, Button, ".toolbar.program_pause") def task_pauseresume(): widgets.program_pause.invoke() def task_run(): widgets.program_run.invoke() root_window.unbind("r") # commands.task_run root_window.unbind("p") # commands.task_pause root_window.unbind("s") # commands.task_resume root_window.bind("r", lambda event: rps_cycle()) def rps_cycle(): s.poll() if( s.task_mode == linuxcnc.MODE_MANUAL ): if( s.interp_state == linuxcnc.INTERP_IDLE ): task_run() elif( s.task_mode == linuxcnc.MODE_AUTO ): if( s.interp_state == linuxcnc.INTERP_WAITING or s.interp_state == linuxcnc.INTERP_PAUSED ): task_pauseresume() elif( s.task_mode == linuxcnc.MODE_MDI ): if( s.interp_state == linuxcnc.INTERP_READING or s.interp_state == linuxcnc.INTERP_PAUSED ): task_pauseresume()