0

My Whole Program is Working in a Loop like this

myWindow = Tk()
myWindow.title("Live Data")
myWindow.geometry("500x600")

def my_mainloop():
    statements....
    myWindow.after(1000, my_mainloop)

myWindow.after(1000, my_mainloop)
myWindow.mainloop()

I want to implement something(button/checkbox), which is changing a value in variable like 0 and 1

so i can use this value (0/1) in this infinite loop to code my logic

A Click will change value to 1 and then another click will change value to 0.

Thank you.

SilentHG
  • 109
  • 1
  • 12
  • @Jordan that is related running a While True loop in Tkinter, and yes the program reaches the last line, even i don't know how, but it does. – SilentHG Apr 24 '20 at 17:48
  • @stovfl i don't want to toggle value through code, i want to toggle through GUI – SilentHG Apr 24 '20 at 17:49
  • @stovfl that statement represents that all the coding is there, end_user wants to toggle values through GUI, not by opening code and changing the value there – SilentHG Apr 24 '20 at 17:58
  • Does this answer your question? [How to toggle a value in Python](https://stackoverflow.com/questions/8381735/how-to-toggle-a-value-in-python) – stovfl Apr 24 '20 at 18:04

1 Answers1

-1

my example:

def change_value(*arg):
    value = 1
button(myWindow, text, command=change_value)
rn0mandap
  • 333
  • 1
  • 8