[pygtk] gtk.Entry / gtk.Completion behavior -- can I change it?

Kim Novak kim at trdlnk.com
Wed Mar 8 02:09:21 WST 2006


You can also call set_inline_completion(True) on your EntryCompletion. 
This will complete the text field inline with the unique result, you can 
then hit tab to auto-complete.  One thing I noticed is if your possible 
values are JBA01, JBA02, JBA03, ... when you type 'J' the inline 
completion is 'JBA0', this is not quite a valid value but you can hit 
enter then type the last trailing character(s) to finish.

I noticed the same issue with the arrow down then tab.
Kim

Chris Gonnerman wrote:
> Danny Milosavljevic wrote:
>> I tried with gtk+ 2.8.9 and there I confirm that it works strangely
>> (assuming you mean gtk.EntryCompletion). 
> Oops, yes, I do mean gtk.EntryCompletion.
>> Typing some prefix into the entry causes - the listbox to pop up
>> - the first item to be selected <- this one drives me nuts, can't it
>> stop getting in my way?
>>
>> Then press down arrow and press tab, indeed, it takes the wrong one...
> On my system, tab selects nothing; the typed text is allowed
> to remain as is.
>> I'd file a bug with gtk...
> I'm considering it.
>
> Logically, I should be able to:
>
>    1. Return True from the key-press-event handler for the
>       EntryCompletion when a Tab is detected and an item in
>       the completion list is highlighted, so that the Tab
>       is ignored,
>    2. In the same handler, synthesize Return and then Tab
>       events in sequence, so that the highlighted item is
>       inserted into the Entry before focus moves.
>
> Of course, the handler must not create a loop in this
> situation; some sort of flag might be used to prevent the
> synthetic Tab from triggering the process all over again.
>
> I'm unsure of the "correct" way to synthesize keyboard events.
> And, of course, there's always the possibility that this kind
> of arrangement might backfire on me... I'm a 20+ year pro at
> console applications but I've only been doing GUI stuff for a
> handful of years.
>
> Thanks for your advice.
>
> -- Chris.
>
> _______________________________________________
> pygtk mailing list   pygtk at daa.com.au
> http://www.daa.com.au/mailman/listinfo/pygtk
> Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


More information about the pygtk mailing list