Tkinter callback caused abnormal program termination

Discussion in 'Python' started by John Pote, Nov 9, 2004.

  1. John Pote

    John Pote Guest

    Running my programme in Python 2.3.4 I received the following msg in the
    consol :-
    (Pent III running W2K prof)

    """
    Exception in Tkinter callback
    Traceback (most recent call last):
    File "c:\apps\python\234\lib\lib-tk\Tkinter.py", line 1345, in __call__
    return self.func(*args)
    File "c:\apps\python\234\lib\lib-tk\Tkinter.py", line 459, in callit
    self.deletecommand(tmp[0])
    AttributeError: 'str' object has no attribute 'deletecommand'
    UpdateStringProc should not be invoked for type option

    abnormal program termination
    """
    There was no other traceback information.

    Could this be related to lines of the ilk:-
    self.infoSpd.config(text="%d.%01d"%spd)
    where infoSpd is a Tkinter Label object placed using the grid manager.

    Thousands of these updates were performed so the labels displayed progress
    through a memory dump of a system accessed through a serial port.

    I had trouble before with Python versions 2.2.1 and 2.2.3 where commenting
    out these Label updates stopped the system crashing and it was happy to run
    for hours performing tests on the external hardware. (an embedded data
    logger I'm developing)

    Anyone any thoughts?

    John
     
    John Pote, Nov 9, 2004
    #1
    1. Advertising

  2. On Tue, 09 Nov 2004 17:41:56 GMT, John Pote <>
    wrote:

    > Running my programme in Python 2.3.4 I received the following msg in the
    > consol :-
    > (Pent III running W2K prof)
    >
    > """
    > Exception in Tkinter callback
    > Traceback (most recent call last):
    > File "c:\apps\python\234\lib\lib-tk\Tkinter.py", line 1345, in __call__
    > return self.func(*args)
    > File "c:\apps\python\234\lib\lib-tk\Tkinter.py", line 459, in callit
    > self.deletecommand(tmp[0])
    > AttributeError: 'str' object has no attribute 'deletecommand'
    > UpdateStringProc should not be invoked for type option
    >
    > abnormal program termination
    > """
    > There was no other traceback information.
    >
    > Could this be related to lines of the ilk:-
    > self.infoSpd.config(text="%d.%01d"%spd)
    > where infoSpd is a Tkinter Label object placed using the grid manager.
    >
    > Thousands of these updates were performed so the labels displayed
    > progress
    > through a memory dump of a system accessed through a serial port.
    >
    > I had trouble before with Python versions 2.2.1 and 2.2.3 where
    > commenting
    > out these Label updates stopped the system crashing and it was happy to
    > run
    > for hours performing tests on the external hardware. (an embedded data
    > logger I'm developing)
    >
    > Anyone any thoughts?
    >
    > John



    Only one (thought that is) Are you updating thses Label widgets from other
    threads? and could you possibly post an example?

    Martin

    --
    Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
     
    Martin Franklin, Nov 10, 2004
    #2
    1. Advertising

  3. John Pote

    John Pote Guest

    "Martin Franklin" <> wrote in message
    news:...
    > On Tue, 09 Nov 2004 17:41:56 GMT, John Pote <>
    > wrote:
    >
    >> Running my programme in Python 2.3.4 I received the following msg in the
    >> consol :-
    >> (Pent III running W2K prof)
    >>
    >> """
    >> Exception in Tkinter callback
    >> Traceback (most recent call last):
    >> File "c:\apps\python\234\lib\lib-tk\Tkinter.py", line 1345, in __call__
    >> return self.func(*args)
    >> File "c:\apps\python\234\lib\lib-tk\Tkinter.py", line 459, in callit
    >> self.deletecommand(tmp[0])
    >> AttributeError: 'str' object has no attribute 'deletecommand'
    >> UpdateStringProc should not be invoked for type option
    >>
    >> abnormal program termination
    >> """
    >> There was no other traceback information.
    >>
    >> Could this be related to lines of the ilk:-
    >> self.infoSpd.config(text="%d.%01d"%spd)
    >> where infoSpd is a Tkinter Label object placed using the grid manager.
    >>
    >> Thousands of these updates were performed so the labels displayed
    >> progress
    >> through a memory dump of a system accessed through a serial port.
    >>
    >> I had trouble before with Python versions 2.2.1 and 2.2.3 where
    >> commenting
    >> out these Label updates stopped the system crashing and it was happy to
    >> run
    >> for hours performing tests on the external hardware. (an embedded data
    >> logger I'm developing)
    >>
    >> Anyone any thoughts?
    >>
    >> John

    >
    >
    > Only one (thought that is) Are you updating thses Label widgets from
    > other
    > threads? and could you possibly post an example?
    >
    > Martin



    Ahhhh -- Experience had already taught me that lesson about tkinter. On
    checking my code guess what I found I'd done - called the widget.config
    method from the other thread. So I put in a list to queue the label updates
    from the other thread to the tkinter thread and it's now been running for
    several hours without problem.

    Thanks for the reminder.

    BTW the program structure I've been using is:-

    def otherThread():
    while TRUE:
    if updatelabel:
    labelQ = "new label text"

    def guiLoop():
    if labelQ:
    myLabel.config(text=labelQ)
    labelQ = None
    #re-register this fn to run again
    rootWin.after(10, guiLoop) #strangely .after_idle(guiLoop) is slower!
    ..
    ..
    rootWin = Tk(className=" tester")

    #rest of GUI set up. then:-

    thread.start_new( otherThread, () )
    rootWin.after(50, guiLoop)
    rootWin.mainloop()

    It works but is it the best way to do this sort of thing? The point is that
    I need moderately fast serial comms, which I do in 'otherThread' and found
    the 'after' and 'after_idle' call backs were too slow. The timing I did on
    py2.2.1 indicated that 'after_idle' could not do better than ~70ms and
    'after(10, ....)' was faster, 30-40 ms, but still too slow for my app.

    Any more thoughts appreciated.

    John
     
    John Pote, Nov 11, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. R6_2003
    Replies:
    1
    Views:
    570
    Peter van Merkerk
    Oct 23, 2003
  2. Mahmood Ahmad
    Replies:
    3
    Views:
    590
    Mahmood Ahmad
    Feb 22, 2004
  3. Hugh
    Replies:
    2
    Views:
    425
  4. PyDenis
    Replies:
    16
    Views:
    844
    Chris Mellon
    Mar 15, 2006
  5. Abnormal program termination

    , Sep 1, 2006, in forum: C Programming
    Replies:
    9
    Views:
    490
    Walter Roberson
    Sep 1, 2006
Loading...

Share This Page