insert_text is a non-canonical name of the signal. Usually they’re internally converted to the canonical form (insert-text here), but in some cases that may not work. In doubt, always prefer the canonical form.
Huh… I just tried an I can confirm it doesn’t work
Weird… especially since it used to work in gtk3.
Probably a bug, I’ll have a look.
In the meanwhile you can connect to the buffer’s inserted-text signal instead:
insert_text is a non-canonical name of the signal. Usually they’re internally converted to the canonical form (insert-text here), but in some cases that may not work. In doubt, always prefer the canonical form.
Good to know.
Should buffer.stop_emission_by_name(‘inserted-text’) stop the character from being inserted in the Entry?
With that code, if multiple characters are entered at once (like when pasting text from the clipboard), the whole text will be rejected if the last char is alpha or punct, but accepted if an alpha/punct is not in the last position…
Is it what you want?
If not, can you give some more examples of what you want to filter out?
I want to limit the input to numbers ( I’ve just seen I can use the unichar_isdigit function ) but I don’t want the Entry to accept pasted text. Is there an easy way to achive this?