logo       

Re: Using Combox Box: msg#00143

gnome.gtk+.python

Subject: Re: Using Combox Box

On Monday 27 December 2004 20:54, Chuck Robey wrote:
>
> I can't seem to be allowed to call a connect on the signal I want (popdown
> event would have been quite high on my list) ... maybe this is a python
> issue? That maybe I should be doing the connect against the parent
> widget? Anyone know if this is true, and (if so) how I might access the
> parent? If it's true, maybe I can read that last one in my python
> documentation.
>

I tried to do two things to see if was possible to do something similar, first
I added all the event mask to the ComboEntry and see which kind of event it
emit:

import pygtk
pygtk.require('2.0')
import gtk

class FirstWin(gtk.Window):
def __init__(self):
gtk.Window.__init__(self, gtk.WINDOW_TOPLEVEL)
self.connect("destroy", lambda w: gtk.main_quit())
combo = gtk.ComboBoxEntry()
combo.add_events(gtk.gdk.ALL_EVENTS_MASK)
combo.connect("event", self.doPrint)
self.add(combo)
self.show_all()

def doPrint(self, widget, event, data=None):
print event.type

def main(self):
gtk.main()

if __name__ == "__main__":
first = FirstWin()
first.main()


But seems that only a few events are emitted, the one that is close to what
you want is the expose event, button-press-event no way.
The only problem is that this signal is emitted more than what you would like
to do, so you will have more refresh of your list than the desired.

import pygtk
pygtk.require('2.0')
import gtk

class FirstWin(gtk.Window):
def __init__(self):
gtk.Window.__init__(self, gtk.WINDOW_TOPLEVEL)
self.connect("destroy", lambda w: gtk.main_quit())
combo = gtk.ComboBoxEntry()
combo.connect("expose-event", self.doPrint)
self.add(combo)
self.show_all()

def doPrint(self, widget, event, data=None):
print "refresh"

def main(self):
gtk.main()

if __name__ == "__main__":
first = FirstWin()
first.main()

The expose event is emitted both when you click the button but also when the
pointer goes over the button itself.

That's all I could find :)

cheers
--
Gian Mario Tagliaretti
_______________________________________________
pygtk mailing list pygtk@xxxxxxxxxx
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/



<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise