Re: [Tkinter-discuss] (newbie) can't invoke button for twice

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Guilherme Polo

    Re: [Tkinter-discuss] (newbie) can't invoke button for twice

    On Sat, Sep 20, 2008 at 4:10 PM, dmitrey <dmitrey15@ukr. netwrote:
    >
    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.upda te_idletasks()
    p.tmp_result = p.solve(*p._arg s, **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-c...p19588292.html
    Sent from the Python - tkinter-discuss mailing list archive at Nabble.com.
    >
    _______________ _______________ _______________ __
    Tkinter-discuss mailing list
    Tkinter-discuss@python. org

    >


    --
    -- Guilherme H. Polo Goncalves
Working...