473,320 Members | 2,088 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

pyGTK on Mouse over event ?

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
7 6621
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
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
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
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Samuele Giovanni Tonon | last post by:
hi, i'm trying to develop a trivial application which random copy files from a directory to another one. i made it using pygtk for the graphical interface, however i find some problem with...
0
by: dataangel | last post by:
I want to make a pygtk app that consists completely of a window. When I run it, a menu should appear where the mouse cursor is. I've been looking at the official pygtk tutorial and documentation,...
25
by: TPJ | last post by:
GUI's etc: PyGtk on Windows "(...) So if someone develops mainly for X and just wants to make sure that it is not impossible to run on Windows, you can use PyGTK. (...)", July 2nd, 1999 pyGTK...
1
by: Luigi | last post by:
Hi all! I have an application that uses a gtk.Notebook to show the content of a GUI. Each page of it has a gtk.Label with a text that explains the content. Each page is added to the notebook...
0
by: Peter TB Brett | last post by:
Hi folks, I'm currently trying to work out how to detect when a PyGTK window receives the focus from the window manager -- I assume that it must receive some kind of X event, but I can't work...
10
by: jubei | last post by:
I've been trying to write a custom widget for a project, however when i try to run code that uses it i get the following error > ./nokiagui.py Traceback (most recent call last): File...
5
by: xrado | last post by:
when i say window.hide(), window dont hide imidetly i want to hide it for a few seconds, do something and then show it back how can i do this? i have this example: import pygtk,time...
1
by: manatlan | last post by:
I was a fan of "SimpleGladeApp/tepache way" to build a pygtk app. I've build a new efficient/dynamic way to build a pygtk app ... Here is an example :...
2
by: Laharl | last post by:
I'm working in pyGTK (completely new to it) and I need to display a tic-tac-toe board. It doesn't have to keep track of the game state, just place Xs and Os on click. Unfortunately, I can't get all 9...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.