> Part of my scheme to write the cells (all 81 of them in the gui) to a file > (using the the SAVE callback/button), then > restore the gui cells from the contents of the saved file, which depends on > knowing the "name" of the cell with the > focus, or one (or more) which have a number. > > The print shows .9919624.9990312, but this nunber (name?) does not work in: > > cell-name of cell-.create_text(18,18, text = somevar, fill = 'blue' , font = > ('arial', 18, 'bold'))
I'm not entirely sure what you are after here. To me it sounds better to create names like "cell%i" % row * column just for the sake of having different names, but store the cell in a 2-dimensional list called e.g. "cells" Then accessing the cell at x, y is simply cells[x][y].create_text(...) Does that make sense to you? > > Also, how can I declare a variable outside of the mainloop/callback scheme > which would be 'known' to the callbacks? You can of course go for globals. Beside that, a callback can be anything callable. That means that you can go for something like this: class StatefulCallable(obkect): def __init__(self, some_state): self.state = some_state def __call__(self, *args): # I'm not sure what comes with the callback print "called with args %r and state %r" % (args, self.state) Then pass an instance of StatefulCallable as callback. Regards, Diez -- http://mail.python.org/mailman/listinfo/python-list