Connecting Tech Pros Worldwide Forums | Help | Site Map

pyGTK on Mouse over event ?

Domenique.Tilleuil@gmail.com
Guest
 
Posts: n/a
#1: Jul 19 '05
hello,

Is there an event simular to the java event onMouseOver ?
I want to get the coordinates of the mouse pointer when it is over an
image ( GTKImage widget)

I've tried using the EventBox with the motion_notify but that only
seems to work when the mouse is pressed ?


tiissa
Guest
 
Posts: n/a
#2: Jul 19 '05

re: pyGTK on Mouse over event ?


Domenique.Tilleuil@gmail.com wrote:[color=blue]
> hello,
>
> Is there an event simular to the java event onMouseOver ?
> I want to get the coordinates of the mouse pointer when it is over an
> image ( GTKImage widget)
>
> I've tried using the EventBox with the motion_notify but that only
> seems to work when the mouse is pressed ?
>[/color]
Why do you use an event box?
Image derives from Widget hence can be connected to the
motion-notify-event just like EventBox. Did you try directly?
Domenique.Tilleuil@gmail.com
Guest
 
Posts: n/a
#3: Jul 19 '05

re: pyGTK on Mouse over event ?


if i add a motion_notify or even a butten_press event to an image
object it does absolutly nothing :s

tiissa
Guest
 
Posts: n/a
#4: Jul 19 '05

re: pyGTK on Mouse over event ?


Domenique.Tilleuil@gmail.com wrote:[color=blue]
> if i add a motion_notify or even a butten_press event to an image
> object it does absolutly nothing :s
>[/color]
I have tried coding a simple application in pyGTK and I remember I had
trouble getting button_press event in a DrawingArea.
I was using glade and despite having declared a handler to this event, I
had to manually call add_events(gtk.gdk.BUTTON_PRESS_MASK) (the connect
was ok but the event mask was not).
Have you checked this?
Domenique.Tilleuil@gmail.com
Guest
 
Posts: n/a
#5: Jul 19 '05

re: pyGTK on Mouse over event ?


def __init__(self):
xml = gtk.glade.XML("/home/domenique/project1.glade")
self.window = xml.get_widget("window1")
self.img = xml.get_widget("image1")
self.img.set_from_file("./test.svg")
self.img.show()
self.img.add_events(gtk.gdk.BUTTON_MOTION_MASK)
xml.signal_autoconnect({
'on_window1_delete_event': self.on_window1_delete_event,
'on_window1_destroy_event': self.on_window1_destroy_event,
'on_image1_motion_notify_event': self.on_image1_motion_notify_event,
'on_image1_button_press_event': self.img_key_press,
})

This is the code so far. i've added the MOTION MASK to the image
widget, is that what u ment ?

tiissa
Guest
 
Posts: n/a
#6: Jul 19 '05

re: pyGTK on Mouse over event ?


Domenique.Tilleuil@gmail.com wrote:[color=blue]
> def __init__(self):
> xml = gtk.glade.XML("/home/domenique/project1.glade")
> self.window = xml.get_widget("window1")
> self.img = xml.get_widget("image1")
> self.img.set_from_file("./test.svg")
> self.img.show()
> self.img.add_events(gtk.gdk.BUTTON_MOTION_MASK)
> xml.signal_autoconnect({
> 'on_window1_delete_event': self.on_window1_delete_event,
> 'on_window1_destroy_event': self.on_window1_destroy_event,
> 'on_image1_motion_notify_event': self.on_image1_motion_notify_event,
> 'on_image1_button_press_event': self.img_key_press,
> })
>
> This is the code so far. i've added the MOTION MASK to the image
> widget, is that what u ment ?
>[/color]
Yes.
But I guess by your question it doesn't work better than before. Sorry I
didn't help much. :/
Domenique.Tilleuil@gmail.com
Guest
 
Posts: n/a
#7: Jul 19 '05

re: pyGTK on Mouse over event ?


no problem i'll just keep using the eventbox but is there an event wich
is triggert when the mouse moves over the eventbox ?

tiissa
Guest
 
Posts: n/a
#8: Jul 19 '05

re: pyGTK on Mouse over event ?


Domenique.Tilleuil@gmail.com wrote:[color=blue]
> def __init__(self):
> xml = gtk.glade.XML("/home/domenique/project1.glade")
> self.window = xml.get_widget("window1")
> self.img = xml.get_widget("image1")
> self.img.set_from_file("./test.svg")
> self.img.show()
> self.img.add_events(gtk.gdk.BUTTON_MOTION_MASK)
> xml.signal_autoconnect({
> 'on_window1_delete_event': self.on_window1_delete_event,
> 'on_window1_destroy_event': self.on_window1_destroy_event,
> 'on_image1_motion_notify_event': self.on_image1_motion_notify_event,
> 'on_image1_button_press_event': self.img_key_press,
> })
>
> This is the code so far. i've added the MOTION MASK to the image
> widget, is that what u ment ?
>[/color]
Actually I read too fast. I meant BUTTON_PRESS_MASK (not motion) for the
button_press_event.
For motion_notify_event, I guess it would be POINTER_MOTION_MASK (not
button).

Closed Thread