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?
_______________________________________________
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