While working on a batch organizing tool, I found out the hard way that GTK’s EntryCompletion is not meant for people who want speed. (It’s a memory aid, not a speed aid) I also couldn’t just switch to PyQt or wxPython because they all do basically the same thing.
As such, I hacked the GTK auto-complete up a bit so that it behaves more like shell auto-complete. (It doesn’t do anything until you hit Tab. When you do, if there’s one match, it’s completed. If there are multiple matches, it pops open the normal auto-complete list so you can pick one.
Hope this help someone. I know I would have liked to find this in my Google results.
Update: If you’d like to preserve normal tab behaviour when the box is empty, just change line 28 to
if event.keyval == KEY_TAB and self.get_text():. Of course, make sure you explain the behaviour and provide some sort of workaround for tabbing when the field isn’t empty. (In my app, pressing enter to submit the contents and clear the field is a perfectly acceptable solution)
PyGTK Tab-Completion by Stephan Sokolow is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.