[Tutor] A little help with TKinter please ....!!
alan.gauld@bt.com
alan.gauld@bt.com
Wed, 21 Aug 2002 17:51:14 +0100
> class Install(Frame):
> def __init__(self,parent,myFileName):
>
> Install(None,"textfile").mainloop()
>
> My question is how do I get self.data out of the class and
> back to the code after the 'mainloop' call ?
GUI = Install(None,"textfile")
GUI.mainloop()
print GUI.data
However in general you want the GUI to keep running while
you access the data. One way to do that is to create the
other objects first then pass them as instances into your
GUI - rather like you did the filename. Then within the
GUI event handlers you camn call methods of the external
objects passing them the data they need. This usually
turns out to be more reusable than the other way round
wherein the external objects need to know about the
GUI internals.
Without knowing exactly what your GUI does/looks like its
hard to be more concrete...
HTH,
Alan G.