Tkinter & Python: how to get the return of a call associated to an event on my gui

aurel-le-gnou aurelienviolet at noos.fr
Thu Jun 20 23:52:04 EDT 2002


Hi


I would like to thank all the people who have helped me these last days
on tkinter programming. (HTML links in a GUI tkinter/ Help for Tkinter
and python's programming)
I'm surprised for being helped with so kindless. 
Special thanks to Russell E. Owen whose response was really excellent
and who also learned me lots of things interessants.

I have another problem with my GUI :/


Here are some extract of my source code:



---------------------------------------------------------------------

class Result:

    def __init__(self):
        # code d'erreur
        self.result = 0
        # nombre de pages non touvées
        self.num_pages = 0
        # les pages non trouvées
        self.pages_not_found = []
        # diverses exceptions
        self.exceptions = []
        # la liste des urls et leur rang associé
        self.results = []


------------------------------------------------------------------

def GenericCallback(callback, *firstArgs, **firstKWArgs):

     if firstKWArgs:
         return GC(callback, *firstArgs, **firstKWArgs)
     else:
         return GCNoKWArgs(callback, *firstArgs)

class GCNoKWArgs:

     def __init__(self, callback, *firstArgs):
         self.__callback = callback
         self.__firstArgs = firstArgs
         
     def __call__(self, *args, **kwArgs):
         return self.__callback (*(self.__firstArgs + args), **kwArgs)

----------------------------------------------------------------------------

def make_call(frame_left, frame_right, button_number, button_search,
button_language, button_rank, button_engine, event):  

 ...

    result = run(button_language_content, button_number_content,
button_search_content, button_rank_content, button_engine_content) 
 ...

    return result

---------------------------------------------------------------------
IN MY MAIN:


myCallback1 = GenericCallback(make_call, window_left, window_right,
button_number, button_search, button_language, button_rank,
button_engine)

button_go.bind("<Button-1>", myCallback1)
button_search.bind("<Return>", myCallback1)


----------------------------------------------------------------------


here is my question, if you could help me, it would be really fine:


"result" is an instance of the class "Result" and is returned by the
call of 'run' without any problem. It's also returned by the call of
"make_call".
But as you can see, "make_call" is binded with an event.
I would like to know how to get the object "result" returned by this
call in my main.
I need this object "result" in my main, but i don't success in getting
it after the event <button-1> on the button_go and the execution of
"make_call"


Thanks a lot for all this help


Aurélien Violet
aurelienviolet at noos.fr





More information about the Python-list mailing list