Is it possible to run a while loop and check for tkinter input in python 3
<p>I have the following code, which is a much simplified version of another program, but i can't get the tkinter window buttons to respond, and so was wondering if it was possible to get the <code>bck</code> and <code>nxt</code>
functions to call on button press and not just at the start, yet still execute the run loop. I would also like to know, if it is possible, if it is possible to modify a variable in a function, which is run on tkinter button press, but be able to use the modified variable outside of that function. Thanks in advance.</p>

<pre><code>import time
import tkinter as tk

def nxt(count):
    print("Forward", (count+1))
def bck(count):
    print("Back", (count-1))

def run(count, root):
    while True:
        count+=0.1
        time.sleep(0.1)
        print(count)
        root.update()
        if count==100:
            break

root=tk.Tk()
root.geometry("100x100-0+0")
count=0

fwd=tk.Button(root, text="Next", command=nxt(count)).pack()
bck=tk.Button(root, text="Previous", command=bck(count)).pack()

root.update()
run(count, root)
root.mainloop()
</code></pre>