[pygtk] converting characters to uppercase as they are being
type in gtk.Entry
Arnau Sanchez
arnau at ehas.org
Tue Sep 19 02:43:50 WST 2006
Troy Nelson escribió:
> How to convert the characters to uppercase as they are being type in an
> gtk.Entry widget? your help is very much appreciated!
>
Hello Troy,
Many ways to do this. The simplest: capture the entry's "changed" signal and
make the text uppercase; this way works also for text pasted from the clipboard:
def on_entry_changed(entry):
new_text = entry.get_text().upper()
entry.set_text(new_text)
entry.connect("changed", on_entry_changed)
Reference:
http://www.pygtk.org/pygtk2reference/class-gtkeditable.html#signal-gtkeditable--changed
http://www.pygtk.org/pygtk2reference/class-gtkentry.html#method-gtkentry--set-text
arnau
ps: [offtopic] a question for the owners of the list: when I make a reply to a
message, it does not appear the mailing list address as destination but only the
person who wrote the message. This may be the reason why so many people answer
privately without noticing. Is this the desired behaviour?
More information about the pygtk
mailing list