Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 620763
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T18:47:58+00:00 2026-05-13T18:47:58+00:00

I’m building a small PyGTK application and I have an text input field (currently

  • 0

I’m building a small PyGTK application and I have an text input field (currently a ComboBoxEntry) which is populated with a few values that the user should be able to choose from.

I think what I want to do is to filter out the matching fields and only show those ones so the user using the keyboard arrows can choose one of the matching ones.

To give some background the predefined values are a bunch of urls and the user should be able to choose from theese or fill in a new one.

Example:
the predefined urls:

  • http://www.google.com
  • http://www.google.com/android
  • http://www.greatstuff.com
  • http://www.facebook.com

When a user types ‘http://www.g‘
The three URLs starting with that string is to be shown (in some way) and when typeing ‘http://www.goog‘ the two starting with that is to be shown

Any Ideas?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T18:47:58+00:00Added an answer on May 13, 2026 at 6:47 pm

    An Entry with an EntryCompletion seems more appropriate than a ComboBoxEntry. As always, the tutorial is a good start.

    It’s very easy to set up when the predefined URLs list is small and fixed.
    You just need to populate a ListStore:

    # 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()
    

    Users are not likely to bother typing “http://” or even “www.”, so you probably want to match any part of the URL (e.g. just “og” works!):

    def match_anywhere(completion, entrystr, iter, data):
        modelstr = completion.get_model()[iter][0]
        return entrystr in modelstr
    completion.set_match_func(match_anywhere, None)
    

    This will test every value in the ListStore for a match, so it’s not scalable to huge lists (I mean huge; a 1000 works fine).

    Be sure to play with the various options of EntryCompletion, to configure the most pleasant behavior.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
this is what i have right now Drawing an RSS feed into the php,
I have just tried to save a simple *.rtf file with some websites and
I have a French site that I want to parse, but am running into
Seemingly simple, but I cannot find anything relevant on the web. What is the
Does anyone know how can I replace this 2 symbol below from the string
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I want to count how many characters a certain string has in PHP, but
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.