On Sat, Sep 20, 2008 at 4:10 PM, dmitrey <[EMAIL PROTECTED]> wrote: > > hi all, > I have the problem: > a func has been binded to a Button: > > RunPause = Button(root, textvariable = t, command = lambda: > invokeRunPause(p)) > > def invokeRunPause(p): > if p.state == 'init': > p.state = 'running' > t.set(' Pause ') > p.GUI_root.update_idletasks() > p.tmp_result = p.solve(*p._args, **p._kwargs) > > elif p.state == 'running': > .... > So the problem is that I can't invoke the button RunPause till my > calculations (in p.solve()) will be finished. I can observe it even > graphically, the button doesn't respond when it is pressed. > Could anyone provide a solution?
It is not only the button that doesn't respond, the entire application won't respond if you are blocking tcl from processing anything. This call to p.solve blocks, and, in turn the interpreter can't process events and the GUI remains frozen till p.solve returns. Ideally you should break this p.solve in steps, so you can schedule next steps and the GUI will remain responsible, but if you can't break it, and if it doesn't make sense to run it in another process then you use a thread to solve this. > > Thank you ion advance, Dmitrey. > -- > View this message in context: > http://www.nabble.com/%28newbie%29-can%27t-invoke-button-for-twice-tp19588292p19588292.html > Sent from the Python - tkinter-discuss mailing list archive at Nabble.com. > > _______________________________________________ > Tkinter-discuss mailing list > [EMAIL PROTECTED] > http://mail.python.org/mailman/listinfo/tkinter-discuss > -- -- Guilherme H. Polo Goncalves -- http://mail.python.org/mailman/listinfo/python-list