473,618 Members | 3,005 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 6637
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_PRES S_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_fr om_file("./test.svg")
self.img.show()
self.img.add_ev ents(gtk.gdk.BU TTON_MOTION_MAS K)
xml.signal_auto connect({
'on_window1_del ete_event': self.on_window1 _delete_event,
'on_window1_des troy_event': self.on_window1 _destroy_event,
'on_image1_moti on_notify_event ': self.on_image1_ motion_notify_e vent,
'on_image1_butt on_press_event' : self.img_key_pr ess,
})

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_fr om_file("./test.svg")
self.img.show()
self.img.add_ev ents(gtk.gdk.BU TTON_MOTION_MAS K)
xml.signal_auto connect({
'on_window1_del ete_event': self.on_window1 _delete_event,
'on_window1_des troy_event': self.on_window1 _destroy_event,
'on_image1_moti on_notify_event ': self.on_image1_ motion_notify_e vent,
'on_image1_butt on_press_event' : self.img_key_pr ess,
})

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_fr om_file("./test.svg")
self.img.show()
self.img.add_ev ents(gtk.gdk.BU TTON_MOTION_MAS K)
xml.signal_auto connect({
'on_window1_del ete_event': self.on_window1 _delete_event,
'on_window1_des troy_event': self.on_window1 _destroy_event,
'on_image1_moti on_notify_event ': self.on_image1_ motion_notify_e vent,
'on_image1_butt on_press_event' : self.img_key_pr ess,
})

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_MA SK (not motion) for the
button_press_ev ent.
For motion_notify_e vent, 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
3348
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 progressbar and ListStore: basically i need to make pulse the progressbar while i'm copying files and write filenames copied on the ListStore on to the window.
0
2025
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, but everything seems to assume that I'm either creating a window to put the menu in (I just want it to be the menu floating by itself) or that I want a button press to trigger the menu appearing (it should just pop into existence when I run it). ...
25
4271
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 on Windows "(...) > can i use pyGTK under > Windows???
1
3098
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 with the method append_page(child, tab_label=None), passing a gtk.Label instance as tab_label variable. Now I'd like to connect to the button_press_event of the gtk.Label a function call. I've done something like this:
0
1802
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 out which signal it generates. Searching around the subject on the web doesn't seem to pull up anything useful. I tried the "focus" signal, but that doesn't work the way I'd like it to. For example, the following code only prints the message...
10
5791
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 "/home/jubei/code/nokia/trunk/nokiagui.py", line 427, in ? gui = NewGui() File "/home/jubei/code/nokia/trunk/nokiagui.py", line 193, in __init__ button = pkylib.ComboButton(("foo","bar","baz")) File "/home/jubei/code/nokia/trunk/pkylib.py",...
5
8955
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 pygtk.require('2.0') import gtk
1
1580
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 : ================================================= class Fen(GladeApp): """ Window win .title="Hello" @delete_event
2
1817
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 buttons to show. Currently, I'm trying to use 3 HButtonBoxes of 3 buttons each packed into an VBox. Unfortunately, I get a blank window when I run. I'm running Python 2.5.1 on Ubuntu Gutsy. import pygtk import gtk class TicTacToe: def...
0
8212
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8653
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8595
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8455
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7126
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6101
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5552
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4065
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4150
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.