Python-Tkinter data passing
April 18, 2011 1:13 PM Subscribe
I'm writing a program in Python using Tkinter for GUI stuff. How can I pass data back from my buttons to the logic of my program?
posted by anaelith to computers & internet (9 answers total) 2 users marked this as a favorite
Here is a minimal example:
from Tkinter import *;
window = Tk();
for string in ["a","b"]:
button = MyButton(window,text=string);
counter = 0;
In this example I would like to update the counter to keep track of how many button presses there have been (either a or b, or any button if I extend the example). I'm interested in both the "right" way and the way that would commonly be used. Google has failed me entirely.