I have a button that is normally used to print a line of data when pressed- this part works fine. If another option (a checkbox) is on, data should be printed continuously until that button it pressed again. So, I change its label to 'Stop' and wait for the button state to change from NORMAL to ACTIVE. However, the loop never executes. Here's the relevant code:
self.read_button = Button(master, text='Read Data', command=read_data)
.
.
def read_data(self):
if self.continuous.get()==1:
self.read_button['text']='Stop'
self.read_button['command']=None
self.read_button.update_idletasks()
# The data is never printed.
while self.read_button['state']==NORMAL:
print_data()
self.read_button['text']='Read Data'
self.read_button['command']=read_data
else:
print_data()
Thanks for any help. This seems simple....