By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,767 Members | 1,357 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,767 IT Pros & Developers. It's quick & easy.

pyGTK on Mouse over event ?

P: n/a
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 ?

Jul 19 '05 #1
Share this Question
Share on Google+
7 Replies


P: n/a
Do****************@gmail.com wrote:
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 ?

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?
Jul 19 '05 #2

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

Jul 19 '05 #3

P: n/a
Do****************@gmail.com wrote:
if i add a motion_notify or even a butten_press event to an image
object it does absolutly nothing :s

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?
Jul 19 '05 #4

P: n/a
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 ?

Jul 19 '05 #5

P: n/a
Do****************@gmail.com wrote:
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 ?

Yes.
But I guess by your question it doesn't work better than before. Sorry I
didn't help much. :/
Jul 19 '05 #6

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

Jul 19 '05 #7

P: n/a
Do****************@gmail.com wrote:
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 ?

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).

Jul 19 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.