[Glade-users] blocking some input in entry field




In the entry field that I created in Glade, I would like to block typing anything but digits and dots (IP 
address). I did this in C in _insert_text handler. Now I need to do the same in Python. Any idea how to do 
this in Python?
This is what I have in C:
 
on_myField_insert_text(*editable, *new_text, new_text_length, position, user_data) {
 
  /***go through  new_text skipping invalid characters and writing the good ones into a clean_string,
         getting the count of how many valid characters there are. **/
  if (count > 0) {
     g_signal_handlers_block_by_func (GTK_WIDGET(editable), G_CALLBACK(on_myField_insert_text), user_data);
     gtk_editable_insert_text (editable, clean_str, count, position);
     g_signal_handlers_unblock_by_func (GTK_WIDGET(editable), G_CALLBACK(on_myField_insert_text), user_data);
  }
  g_signal_stop_emission_by_name (GTK_WIDGET(editable), "insert-text");
}
 
This works in C. How can I get this in Python? I am new to Python, so would be greatfull for your help.
Thanks much.
Arthur.                                           
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/glade-users/attachments/20100924/09ac6e9a/attachment-0001.html 




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]