私はこの投稿を見ていました:https ://stackoverflow.com/a/2262200 そして私はコーディングしている小さなことで非常に似た設定をしています。私の質問は、エントリの完了が終了し、入力ボックスにURLが含まれている場合、そのURLを完了から変数に取得するにはどうすればよいですか?entry.get_text()は機能していないようで、他のすべての試みはオブジェクトまたはアドレスを提供しているようです。クリックしたくない場合は、上記のリンクからの引用です。
# simplified example from the tutorial
import gtk
urls = [
'http://www.google.com',
'http://www.google.com/android',
'http://www.greatstuff.com',
'http://www.facebook.com',
]
liststore = gtk.ListStore(str)
for s in urls:
liststore.append([s])
completion = gtk.EntryCompletion()
completion.set_model(liststore)
completion.set_text_column(0)
entry = gtk.Entry()
entry.set_completion(completion)
# boilerplate
window = gtk.Window()
window.add(entry)
window.connect('destroy', lambda w: gtk.main_quit())
window.show_all()
gtk.main()