I am writing tkinter python program for turning on and off the publisher. I need to turn on and off the publisher using a button. If am writing using while loop, the entire gui freezes, I am unable to operate anything. Please give me some suggestions.
dummy = Button(master, text="dummy", relief='groove',command=self.pub_values)
def pub_values(self):
self.pub = rospy.Publisher('/gateway/RigPLC2Seq', Int32MultiArray, queue_size=10)
rospy.init_node('talker_int', anonymous=True)
rate = rospy.Rate(1) # 10hz
self.var = Int32MultiArray()
self.var.data = []
ls = self.extract_values()
self.var.data = ls
self.on = True
while self.on == True:
rospy.loginfo(self.var)
self.pub.publish(self.var)
rate.sleep()