[pygtk] combobox selection

Kelvin Ho kelvin.ho.ka.wai at gmail.com
Tue May 26 23:48:45 WST 2009


Hi,

I'm not sure if I understand you correctly. You want a ComboBox that, when
focussed and a key is pressed, immediately jumps to the cities starting with
the letter, right?

In that case, you just do it like this:


def key_pressed(widget, event):
  print event.keyval

combobox = gtk.combo_box_new_text()
combobox.append_text("HAI")
combobox.connect("key-press-event", key_pressed)

window = gtk.Window()
window.add(combobox)
window.connect("destroy", gtk.main_quit)
window.show_all()

gtk.main()

You'll need to figure out how to connect the event to display the right
cities. Hope that helped.

On Tue, May 26, 2009 at 3:42 PM, anusha k <anuhacks at gmail.com> wrote:

> hai,
>
> i have a combobox when i press specific letter that list starting with that
> letter should come up.so what should i do for thatwhat it is named in
> pygtk.for example:i have cities in a combobox when i press M lette,r
> cities staring with M should show up.
> i know about gtk.comboboxentry and gtk.entrycompletion,but is it possible
> with combobox.
>
>
> Njoy the share of freedom,
> Anusha Kadambala
>
> _______________________________________________
> pygtk mailing list   pygtk at daa.com.au
> http://www.daa.com.au/mailman/listinfo/pygtk
> Read the PyGTK FAQ: http://faq.pygtk.org/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.daa.com.au/pipermail/pygtk/attachments/20090526/11a22830/attachment.htm 


More information about the pygtk mailing list