On Thu, 01 Feb 2001, you wrote:
> Pier wrote:
> > Ricardo Caesar Lenzi wrote:
> > > Try this:
> > >
> > > def on_clist_button_press_event(clist,mousebutton,data):
> > > if mousebutton.type==5:
I think it's somewhat clearer to say (having done "import GDK" somewhere):
if mousebutton.type == GDK._2BUTTON_PRESS:
[from the source, not in any doc I could find...]
> > > print "Double-click!"
> > >
> > > clist.connect("button_press_event",on_clist_button_press_event)
> > >
> > > - Ricardo
> >
> > this does not work because the mousebutton in the previous example returns
> > me a gdkEvent object and
> > I don't know its structure. Probably it contains the information I need
> > but I can't get it
>
> > Can you give me some information about the structure of a GdkEvent object ?
> > (a link to some docs is also appreciate)
>
> I don't remember where I saw that documentation, but one of the
> attributes of gdkEvent is type and, in my pyGtk (0.6.6), gdkEvent.type
> returns 4 when clist get a single click and 5 when get a double click.
>
> Here is a full python program that show this:
>
> --------------------------------------------------
> from gtk import *
>
> w=GtkWindow()
> w.set_default_size(100,100)
> clist=GtkCList()
> clist.append(["item 1"])
> clist.append(["item 2"])
> clist.append(["item 3"])
> clist.show()
> w.add(clist)
> w.show()
> w.connect("destroy",mainquit)
>
> def on_clist_button_press_event(clist,mousebutton,*args):
> print mousebutton.type
>
> clist.connect("button_press_event",on_clist_button_press_event)
>
> mainloop()
> ---------------------------------------------------
>
> You can look at www.gtk.org, in GDK tutorials... this can also help you.
>
> - Ricardo
--
George Young, Rm. L-204 [EMAIL PROTECTED]
MIT Lincoln Laboratory
244 Wood St.
Lexington, Massachusetts 02420-9108 (781) 981-2756
_______________________________________________
pygtk mailing list [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk