I'm looking for a way to add autocomplete functionality to my Windows based Tkinter applications running under Python 2.7 (32-bit).
I've started by using code found on the wiki, but I'm open to other suggestions as well. Ideally I'd like a solution that works with the ttk.Entry widget.
Here's the link to the wiki's auto-complete widget that I'm trying to get to work.
When I run the code on this page, I receive the following traceback:
C:\test>py27 tkautocomplete.py
Type a 't' to test the AutocompleteEntry widget. Will use AutocompleteEntry.set_completion_list((u'test', u'type', u'true', u'tre e', u'time')) Try also the backspace key and the arrow keys. Traceback (most recent call last): File "tkautocomplete.py", line 99, in <module> test(test_list) File "tkautocomplete.py", line 89, in test entry.set_completion_list(test_list) File "tkautocomplete.py", line 35, in set_completion_list self.bind('<KeyRelease>', self.handle_keyrelease) AttributeError: AutocompleteEntry instance has no attribute 'handle_keyrelease'
The traceback complains about a missing handle_keyrelease attribute which is present in the sample code.
I'm using the 32-bit version of Python 2.7 for Windows under Windows 7 Professional.
Thank you,
Malcolm
_______________________________________________ Tkinter-discuss mailing list [hidden email] http://mail.python.org/mailman/listinfo/tkinter-discuss |
Hi,
Tried the code here on Windows 7 using Python 2.7.1, no problem at all. Given that the method handle_keyrelease is explicitly defined in the code at http://tkinter.unpythonic.net/wiki/AutocompleteEntry, my guess is that you have modified the code somehow such that it doesn't work, or changed indentation, or.... Can you send me the code you are running, and I will check it out? Mick On Thu, Jun 23, 2011 at 2:18 PM, <[hidden email]> wrote: > I'm looking for a way to add autocomplete functionality to my Windows based > Tkinter applications running under Python 2.7 (32-bit). > > I've started by using code found on the wiki, but I'm open to other > suggestions as well. Ideally I'd like a solution that works with the > ttk.Entry widget. > > Here's the link to the wiki's auto-complete widget that I'm trying to get to > work. > http://tkinter.unpythonic.net/wiki/AutocompleteEntry > > When I run the code on this page, I receive the following traceback: > > C:\test>py27 tkautocomplete.py > Type a 't' to test the AutocompleteEntry widget. > Will use AutocompleteEntry.set_completion_list((u'test', u'type', u'true', > u'tre > e', u'time')) > Try also the backspace key and the arrow keys. > Traceback (most recent call last): > File "tkautocomplete.py", line 99, in <module> > test(test_list) > File "tkautocomplete.py", line 89, in test > entry.set_completion_list(test_list) > File "tkautocomplete.py", line 35, in set_completion_list > self.bind('<KeyRelease>', self.handle_keyrelease) > AttributeError: AutocompleteEntry instance has no attribute > 'handle_keyrelease' > > The traceback complains about a missing handle_keyrelease attribute which is > present in the sample code. > > I'm using the 32-bit version of Python 2.7 for Windows under Windows 7 > Professional. > > Thank you, > Malcolm > _______________________________________________ > Tkinter-discuss mailing list > [hidden email] > http://mail.python.org/mailman/listinfo/tkinter-discuss > > Tkinter-discuss mailing list [hidden email] http://mail.python.org/mailman/listinfo/tkinter-discuss |
Dear Malcom,
Having looked at your version of the code, I see that the method: def handle_keyrelease(self, event) is indented one tab too far. If you are in Idle, select all of the method, and select "Dedent Region" from the Format menu. Then it should work. Mick On Fri, Jun 24, 2011 at 3:24 PM, Michael O'Donnell <[hidden email]> wrote: > Hi, > > Tried the code here on Windows 7 using Python 2.7.1, > no problem at all. > > Given that the method handle_keyrelease is explicitly defined > in the code at http://tkinter.unpythonic.net/wiki/AutocompleteEntry, > my guess is that you have modified the code somehow such that > it doesn't work, or changed indentation, or.... > > Can you send me the code you are running, and I will check it out? > > Mick > > On Thu, Jun 23, 2011 at 2:18 PM, <[hidden email]> wrote: >> I'm looking for a way to add autocomplete functionality to my Windows based >> Tkinter applications running under Python 2.7 (32-bit). >> >> I've started by using code found on the wiki, but I'm open to other >> suggestions as well. Ideally I'd like a solution that works with the >> ttk.Entry widget. >> >> Here's the link to the wiki's auto-complete widget that I'm trying to get to >> work. >> http://tkinter.unpythonic.net/wiki/AutocompleteEntry >> >> When I run the code on this page, I receive the following traceback: >> >> C:\test>py27 tkautocomplete.py >> Type a 't' to test the AutocompleteEntry widget. >> Will use AutocompleteEntry.set_completion_list((u'test', u'type', u'true', >> u'tre >> e', u'time')) >> Try also the backspace key and the arrow keys. >> Traceback (most recent call last): >> File "tkautocomplete.py", line 99, in <module> >> test(test_list) >> File "tkautocomplete.py", line 89, in test >> entry.set_completion_list(test_list) >> File "tkautocomplete.py", line 35, in set_completion_list >> self.bind('<KeyRelease>', self.handle_keyrelease) >> AttributeError: AutocompleteEntry instance has no attribute >> 'handle_keyrelease' >> >> The traceback complains about a missing handle_keyrelease attribute which is >> present in the sample code. >> >> I'm using the 32-bit version of Python 2.7 for Windows under Windows 7 >> Professional. >> >> Thank you, >> Malcolm >> _______________________________________________ >> Tkinter-discuss mailing list >> [hidden email] >> http://mail.python.org/mailman/listinfo/tkinter-discuss >> >> > Tkinter-discuss mailing list [hidden email] http://mail.python.org/mailman/listinfo/tkinter-discuss |
Dear Mick,
> Having looked at your version of the code, I see that the method: def handle_keyrelease(self, event) is indented one tab too far. Thank you for taking the time to uncover the problem in my code. <embarassed> I can't believe I missed that indentation error! </embarrassed> Thanks again! Malcolm _______________________________________________ Tkinter-discuss mailing list [hidden email] http://mail.python.org/mailman/listinfo/tkinter-discuss |
Free forum by Nabble | Edit this page |