On 8/21/05, Mystilleef <[EMAIL PROTECTED]> wrote:
> Hello,
> 
> I was trying to capture a signal when text is entered into
> gtk.Entry(). But the signals don't seem to be emitted. Have
> I uncovered a bug? I attached an example file to demonstrate
> the problem.
> 
> The workaround seems to be to use the "insert-text" and
> "delete-text" signals instead of the gtk.Entry() ones.
> 
> ============================================================
> 
> #! /usr/bin/env python
> # -*- coding: utf-8 -*-
> 
> import gtk
> 
> class Window(object):
> 
>         def __init__(self):
> 
>                 window = gtk.Window(gtk.WINDOW_TOPLEVEL)
>                 window.connect("delete_event", self.close_window_cb)
>                 window.set_position(gtk.WIN_POS_CENTER)
>                 window.set_border_width(1)
>                 window.set_size_request(200, 50)
> 
>                 entry = gtk.Entry()
>                 self.entry = entry
>                 entry.connect("insert-at-cursor", self.insert_text_cb)
>                 entry.connect("delete-from-cursor", self.delete_text_cb)
> 
>                 window.add(entry)
> 
>                 window.show_all()
> 
> 
>         def insert_text_cb(self, entry, string):
> 
>                 print "I got called"
>                 print entry
>                 print string
> 
> 
>         def delete_text_cb(self, entry, delete_type, count):
> 
>                 print "I got called."
>                 print entry
> 
> 
>         def close_window_cb(self, widget, event, data=None):
> 
>                 gtk.main_quit()
> 
>                 return False
> 
> def main():
>         gtk.main()
> 
> if __name__ == "__main__":
>         Window()
>         main()
> 
> ============================================================
> 
> 
> 

More information about my system.

Python 2.4.1 (#2, Jun 21 2005, 09:39:54)
[GCC 3.4.4 (Gentoo 3.4.4, ssp-3.4.4-1.0, pie-8.7.8)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import gtk
>>> gtk.pygtk_version
(2, 6, 2)
>>> gtk.gtk_version
(2, 6, 10)
>>>
_______________________________________________
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