[issue3774] tkinter Menu.delete bug
Hirokazu Yamamoto [EMAIL PROTECTED] added the comment: Fixed in r67082(trunk), r67083(release26-maint), r67084(release25-maint). -- keywords: -needs review resolution: - fixed status: open - closed versions: +Python 2.7 ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue3774 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3774] tkinter Menu.delete bug
Dan OD [EMAIL PROTECTED] added the comment: Sorry to drag this up again, but if no-one has any complaints it would be a huge help if gpolo's patch could be checked in. Thanks ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue3774 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3774] tkinter Menu.delete bug
Benjamin Peterson [EMAIL PROTECTED] added the comment: Could you port this to 3.0, please? ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue3774 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3774] tkinter Menu.delete bug
Hirokazu Yamamoto [EMAIL PROTECTED] added the comment: Done. Fixed in r67095(py3k). ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue3774 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3774] tkinter Menu.delete bug
Hirokazu Yamamoto [EMAIL PROTECTED] added the comment: I think gpolo's patch can go. I'm not sure (self._tclCommands is not None) check is not really needed. I want to cancel this opinion. I saw no self._tclCommands check before any other deletecommand() call, I beleive this is OK. ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue3774 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3774] tkinter Menu.delete bug
Martin v. Löwis [EMAIL PROTECTED] added the comment: gpolo's patch issue3774_2.diff does seem to fix this bug, but it's not in the SVN trunk - could this be done before 2.6 final? Definitely not. The release is about to be produced today. ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue3774 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3774] tkinter Menu.delete bug
Dan OD [EMAIL PROTECTED] added the comment: It may be because I'm calling delete incorrectly (I don't think so - see below) but I'm getting an error File C:\CCPN\ccpn\python\memops\gui\Menu.py, line 127, in deleteMenuItems self.delete(0, Tkinter.END) File C:\Python-2.6_svn\lib\lib-tk\Tkinter.py, line 2670, in delete if c in self._tclCommands: TypeError: argument of type 'NoneType' is not iterable Which can easily be fixed with - if c in self._tclCommands: + if c and c in self._tclCommands: line 2670 Tkinter.py Should I create a patch or have I missed something? Thanks. ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue3774 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3774] tkinter Menu.delete bug
Dan OD [EMAIL PROTECTED] added the comment: Please forgive my rookie bug filing: I'm getting this bug / crash sometimes when Menu.delete() is called too It seems to be because self.index( ) sometimes returns None which is of course un-iterable and delete() tries to iterate through it: for i in range(self.index(index1), self.index(index2)+1): As a fix the previous (simpler) delete works for me, but I don't understand the purpose of the extra self.deletecommand() code appended so I'm probably missing something. My crash: File C:\CCPN\ccpn\python\memops\gui\Menu.py, line 127, in deleteMenuItems self.delete(0, Tkinter.END) File C:\Python26\lib\lib-tk\Tkinter.py, line 2665, in delete for i in range(self.index(index1), self.index(index2)+1): TypeError: unsupported operand type(s) for +: 'NoneType' and 'int' -- nosy: +indiedan ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue3774 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3774] tkinter Menu.delete bug
Hirokazu Yamamoto [EMAIL PROTECTED] added the comment: for i in range(self.index(index1), self.index(index2)+1): Probably your working copy is bit old. Please try latest file. This issue was fixed in r65971. :-) # I've added nosy list from issue1342811. -- nosy: +benjamin.peterson, gpolo, loewis, schuppenies, svenil ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue3774 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3774] tkinter Menu.delete bug
Guilherme Polo [EMAIL PROTECTED] added the comment: Python 2.6b2 was released with this bug, and got fixed later. -- resolution: - out of date status: open - closed ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue3774 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3774] tkinter Menu.delete bug
Guilherme Polo [EMAIL PROTECTED] added the comment: I meant beta3, sorry. ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue3774 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3774] tkinter Menu.delete bug
Guilherme Polo [EMAIL PROTECTED] added the comment: Oops, sorry, I misread the bug report, reopening it (let me go eat something now). -- keywords: -easy, needs review resolution: out of date - status: closed - open ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue3774 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3774] tkinter Menu.delete bug
Changes by Guilherme Polo [EMAIL PROTECTED]: -- keywords: +easy, needs review ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue3774 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3774] tkinter Menu.delete bug
Dan OD [EMAIL PROTECTED] added the comment: Thanks guys - I was running an old build. revision 65971 fixed this as Hirokazu mentioned. ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue3774 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3774] tkinter Menu.delete bug
Guilherme Polo [EMAIL PROTECTED] added the comment: The patch attached is probably the most direct way to fix it, but, can someone remind why we just don't call deletecommand (if there is a command to delete) and let it try to remove the command from _tclCommand then ? (note that this is not really the case for this bug report). I'm attaching a patch that is a bit different. It relies on the fact that if the menu entry was created with add_command but no command was specified, then there is no command to specify. And if a command was specified then _tclCommands would be a list and deletecommand would work properly. Added file: http://bugs.python.org/file11476/issue3774.diff ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue3774 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3774] tkinter Menu.delete bug
Guilherme Polo [EMAIL PROTECTED] added the comment: Again, I meant the previously attached patch (the one by ocean-city) was the most direct way. ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue3774 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3774] tkinter Menu.delete bug
skomoroh [EMAIL PROTECTED] added the comment: Seems I found the bug. I've attached the patch for current py3k-trunk. Added file: http://bugs.python.org/file11477/menu_fix.patch ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue3774 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3774] tkinter Menu.delete bug
Guilherme Polo [EMAIL PROTECTED] added the comment: My patch already does what is proposed in your patch, except yours may possibly not work. It is not guaranteed that self.entrycget(i, 'command') will return an empty string if the command associated to that menu entry is an empty string. Tcl may return another object containing the representation of this menu command so that if statement will evalute as True while its representation is actually an empty string. ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue3774 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3774] tkinter Menu.delete bug
Hirokazu Yamamoto [EMAIL PROTECTED] added the comment: self.deletecommand doesn't remove menu item, so we don't have to care about index shifting like bellow. +1 for gpolo's patch. a = [0, 1, 2, 3] for i in xrange(len(a)): ... del a[i] ... Traceback (most recent call last): File stdin, line 2, in module IndexError: list assignment index out of range I'm not sure (self._tclCommands is not None) check is not really needed. I was looking for the place self._tclCommands is initialized, and found _register() is that place, but what is 'needcleanup'? :-0 But probably, gpolo's patch is right. P.S. This is not related to this issue, I think Delete menu items between INDEX1 and INDEX2 (not included). should be changed to Delete menu items between INDEX1 and INDEX2 (included). Please look at http://www.tcl.tk/man/tcl8.5/TkCmd/menu.htm#M59 ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue3774 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3774] tkinter Menu.delete bug
Guilherme Polo [EMAIL PROTECTED] added the comment: This needcleanup parameter indicates that the function added to _tclCommands needs to (and will) be removed later. Nevertheless, I believe the proper initialization of _tclCommands should be done elsewhere. And about that docstring.. yes, the change is needed. (I could swear I saw it fixed some time ago, but no.. it didn't happen) ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue3774 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3774] tkinter Menu.delete bug
Hirokazu Yamamoto [EMAIL PROTECTED] added the comment: I tried, and I confirmed released python2.5.2 runs fine. and py3k, trunk, release25-maint fails. Probably something changed after 2.5.2 release. -- nosy: +ocean-city versions: +Python 2.5, Python 2.6 ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue3774 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com