Something like that ?

              # Build the listStore
               liststore = gtk.ListStore(str)
               for value in MyValues():
                   liststore.append([value])
               # Build completion
               completion = gtk.EntryCompletion()
               completion.set_model(liststore)
               completion.set_minimum_key_length(0)
               completion.set_text_column(0)
               completion.set_inline_completion(True)
               # Built combobox
               entry = gtk.ComboBoxEntry(liststore, 0)
               entry.get_child().set_completion(completion)
               entry.get_child().set_max_length(itWidth)


rhitam sanyal a écrit :

Hi all.. i am trying to create a combo with the pop down list being modfied in real time as i type each character :
[CODE=python]
import gtk
window=gtk.Window(gtk.WINDOW_TOPLEVEL)
window.connect("destroy",gtk.main_quit)
combo=gtk.Combo()
combo.set_use_arrows(True)

wordlist=['aata','abbay','acute','adistance','bobbby','cat','cbount','daddy']
def entry_callback(widget,combo):
# ------

combo.entry.connect("activate",entry_callback,combo)
window.add(combo)
window.show()
combo.show()
gtk.main()
[/CODE]

now my aim is when i enter a chareacter 'a' into the combo.entry field .. all the words beginning with the letter 'a' wud be set in the popdown list ... if the next character is 'c' , meaning now the entry is 'ac' then the pop down list should be modified to only the word 'acute' .. now the problem is the combo.entry.get_text() function will return a string only when the enter key is pressed .. how do i set the pop down list without pressing the enter key ? :( assuming i already haev a function which is a python version of the C function getch() . returning the character which is pressed on the keyboard .. here is the fucntion:

[CODE=python]

def getch():
    import os, tty

    fd = sys.stdin.fileno()
    tty_mode = tty.tcgetattr(fd)
    tty.setcbreak(fd)
    try:
            ch = os.read(fd, 1)
    finally:
            tty.tcsetattr(fd, tty.TCSAFLUSH, tty_mode)

    return ch
[/CODE]

but this wud catch a chaarcter entered in the console .. how do i do the same for the entry box of the combo.. any help appreciated.
regards,
Rhitam

_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/

_______________________________________________
pygtk mailing list   [email protected]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/



--
Alain Walter - THALES SERVICES
01 69 88 78 73 at Eurocontrol
01 41 48 00 04 at Thales

begin:vcard
n:Walter;Alain
email;internet:[EMAIL PROTECTED]
x-mozilla-html:FALSE
version:2.1
end:vcard

_______________________________________________
pygtk mailing list   [email protected]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/

Reply via email to