Python Forum
Gtk.EntryCompletion, get all suggestions, not only beginning with entered string. - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: GUI (https://python-forum.io/forum-10.html)
+--- Thread: Gtk.EntryCompletion, get all suggestions, not only beginning with entered string. (/thread-13287.html)



Gtk.EntryCompletion, get all suggestions, not only beginning with entered string. - TimeMen - Oct-08-2018

Hey there,

Have a Gtk.EntryCompletion connected to a textbox like this:
liststore = Gtk.ListStore(str)
f = open("vogelarten_dt.info", 'r').readlines()
for item in f:
    liststore.append([item[:-1]])

self.entrycompletion = Gtk.EntryCompletion()
self.entrycompletion.set_model(liststore)
self.entrycompletion.set_text_column(0)

self.entry = self.builder.get_object('Tbo_Species')
self.entry.set_completion(self.entrycompletion)
If i type something into my TextEntry, i got all suggestions from liststore, beginning with the entered string.
So if I type "bi", i get suggestions like "Bienenfresser", "Birkhuhn" or "Birkenzeisig".

How can I reconfigure the Gtk.EntryCompletion to also get suggestions not starting but containing "bi"? Have found a documentation about Python and GTK, but got no information about how to realize the described scenery.

Best Wishes,
TimeMen