I have made a GUI menu with options to start and shut down the python scripts. So far the start button, I am able to run multiple scripts with threading but for the Stop button function, I am still lost.
import time
import threading
from threading import Thread
import rospy
from std_msgs.msg import *
from Tkinter import *
from subprocess import call
import subprocess
data_pub = rospy.Publisher('setup', String, queue_size=10)
def start():
#global arduino
#global arm
#arduino = Popen("/home/ubuntu/catkin_ws/src/tp/scripts/arduino_io_reader1.py")
#arm = Popen("/home/ubuntu/catkin_ws/src/tp/scripts/move_arm.py")
global t1 , t2
t1=threading.Thread(
target=call,
args=("/home/ubuntu/catkin_ws/src/tp/scripts/arduino_io_reader1.py",), )
t1.start()
t2=threading.Thread(
target=call,
args=("/home/ubuntu/catkin_ws/src/tp/scripts/move_arm.py",),)
t2.start()
def stop():
global t1 , t2
#root.destroy()
#print ("Shuttin down..")
t1._stop()
t2._stop()