Tkinter callback caused abnormal program termination

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • John Pote

    #1

    Tkinter callback caused abnormal program termination

    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.deletecomm and(tmp[0])
    AttributeError: 'str' object has no attribute 'deletecommand'
    UpdateStringPro c 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.co nfig(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


  • Martin Franklin

    #2
    Re: Tkinter callback caused abnormal program termination

    On Tue, 09 Nov 2004 17:41:56 GMT, John Pote <johnpote@bluey onder.co.uk>
    wrote:
    [color=blue]
    > 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.deletecomm and(tmp[0])
    > AttributeError: 'str' object has no attribute 'deletecommand'
    > UpdateStringPro c 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.co nfig(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[/color]


    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/

    Comment

    • John Pote

      #3
      Re: Tkinter callback caused abnormal program termination


      "Martin Franklin" <mfranklin1@gat wick.westerngec o.slb.com> wrote in message
      news:mailman.62 01.1100071949.5 135.python-list@python.org ...[color=blue]
      > On Tue, 09 Nov 2004 17:41:56 GMT, John Pote <johnpote@bluey onder.co.uk>
      > wrote:
      >[color=green]
      >> 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.deletecomm and(tmp[0])
      >> AttributeError: 'str' object has no attribute 'deletecommand'
      >> UpdateStringPro c 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.co nfig(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[/color]
      >
      >
      > Only one (thought that is) Are you updating thses Label widgets from
      > other
      > threads? and could you possibly post an example?
      >
      > Martin[/color]


      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(1 0, guiLoop) #strangely .after_idle(gui Loop) is slower!
      ..
      ..
      rootWin = Tk(className=" tester")

      #rest of GUI set up. then:-

      thread.start_ne w( otherThread, () )
      rootWin.after(5 0, guiLoop)
      rootWin.mainloo p()

      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


      Comment

      Working...