Sorry for the noise. But I added one more false info...


It turns out grab_focus works as expected when I first create the window and
entry. Any successive entry, added to this window will not get the focus.

Following code doesn't ever get the focus to the entry... why?

import gtk

class Layout(object):
    def __init__(self):
        self.w = gtk.Window()
        self.b = gtk.HBox()
        self.w.add(self.b)
        self.butt = gtk.Button(label="add entry")
        self.butt.connect('clicked', self.butt_cb)
        self.b.add(self.butt)
        self.w.show_all()

        self.w2 = gtk.Window()
        self.w2.set_default_size(200, 100)
        self.b2 = gtk.VBox()
        self.w2.add(self.b2)
        
        label = gtk.Label('Entries')
        self.b2.add(label)
        self.w2.show_all()
        
    def butt_cb(self, wdg):
        e = gtk.Entry()
        self.b2.add(e) 
        e.show()
        e.grab_focus()
        self.w2.show_all()

l = Layout()
gtk.main()

_______________________________________________
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