Possible bug in Tkinter for Python 2.6

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Eric Brunel

    Possible bug in Tkinter for Python 2.6

    Hello all,

    I'm trying out Python 2.6 and I found what might be a bug in the Tkinter
    module. How can I report it?

    The possible bug is a traceback when trying to delete a menu item in a
    menu where no items have associated commands.

    For example:
    ------------------------------
    from Tkinter import *

    root = Tk()

    mb = Menu(root)
    root.configure( menu=mb)

    fm = Menu(mb)
    mb.add_cascade( label='File', menu=fm)

    fm.add_command( label='Open')
    fm.add_command( label='Quit')

    def remove_menu_ite m():
    fm.delete(1)

    Button(root, text='Remove menu item',
    command=remove_ menu_item).pack (padx=12, pady=24)

    root.mainloop()
    ------------------------------

    Clicking on the button should remove the 'Open' item in the 'File' menu,
    but ends up in a traceback:
    File "/opt/Python2.6+Tk8.5/bin/Linux/lib/python2.6/lib-tk/Tkinter.py",
    line 1410, in __call__
    return self.func(*args )
    File "menu.py", line 15, in remove_menu_ite m
    fm.delete(1)
    File "/opt/Python2.6+Tk8.5/bin/Linux/lib/python2.6/lib-tk/Tkinter.py",
    line 2670, in delete
    if c in self._tclComman ds:

    It just seems the _tclCommands attribute on menus is initialized to None
    and never changed if none of the items actually have a command.

    Thanks!
    --
    python -c "print ''.join([chr(154 - ord(c)) for c in
    'U(17zX(%,5.zmz 5(17l8(%,5.Z*(9 3-965$l7+-'])"
  • Anton Vredegoor

    #2
    Re: Possible bug in Tkinter for Python 2.6

    On Wed, 19 Nov 2008 10:57:53 +0100
    "Eric Brunel" <see.signature@ no.spamwrote:
    I'm trying out Python 2.6 and I found what might be a bug in the
    Tkinter module. How can I report it?
    maybe here:

    The possible bug is a traceback when trying to delete a menu item in
    a menu where no items have associated commands.
    [...]
    It just seems the _tclCommands attribute on menus is initialized to
    None and never changed if none of the items actually have a command
    I ran into the same issue after I downloaded PysolFC-1.1 . I actually
    uploaded a patch for PysolFC for it for Python26 on Ubuntu and forgot
    all about it, thinking it could be some API change. Thanks for nailing
    down the problem a bit more and asking the questions here. It helped me
    to discover the bug reporting facility. According to the link above
    this bug is already reported and fixed, but it's nice to know anyway.

    Now for some really strange bug that still breaks PysolFC-1.1 on windows
    for me with Python26 ... (Python25 not affected):

    .....

    File "c:\python26\li b\lib-tk\Tkinter.py", line 1202, in configure
    return self._configure ('configure', cnf, kw)
    File "c:\python26\li b\lib-tk\Tkinter.py", line 1193, in _configure
    self.tk.call(_f latten((self._w , cmd)) + self._options(c nf))
    _tkinter.TclErr or: image "pyimage237 " doesn't exist

    I suspect there has been some upgrade or new compilation of tcl
    that causes this behavior.

    A.


    Comment

    • Terry Reedy

      #3
      Re: Possible bug in Tkinter for Python 2.6

      Anton Vredegoor wrote:
      On Wed, 19 Nov 2008 10:57:53 +0100
      "Eric Brunel" <see.signature@ no.spamwrote:
      >
      >I'm trying out Python 2.6 and I found what might be a bug in the
      >Tkinter module. How can I report it?
      >
      maybe here:
      http://bugs.python.org/issue3774
      The fix will be in 2.6.1, which might be in December.

      Comment

      • Eric Brunel

        #4
        Re: Possible bug in Tkinter for Python 2.6

        On Wed, 19 Nov 2008 18:51:03 +0100, Terry Reedy <tjreedy@udel.e duwrote:
        Anton Vredegoor wrote:
        >On Wed, 19 Nov 2008 10:57:53 +0100
        >"Eric Brunel" <see.signature@ no.spamwrote:
        >>
        >>I'm trying out Python 2.6 and I found what might be a bug in the
        >>Tkinter module. How can I report it?
        > maybe here:
        >http://bugs.python.org/issue3774
        >
        The fix will be in 2.6.1, which might be in December.
        Thanks! Quite easy to fix anyway, but I prefer having an official version.
        --
        python -c "print ''.join([chr(154 - ord(c)) for c in
        'U(17zX(%,5.zmz 5(17l8(%,5.Z*(9 3-965$l7+-'])"

        Comment

        Working...