commit 5164d9b574186f9ed117af230b4ef448b62d2b1e
parent 64f5d115a47acdb78bbfcbd45105c995ac2f7892
Author: Yuval Langer <yuval.langer@gmail.com>
Date: Thu, 27 Jan 2022 08:37:13 +0200
Add link to the Stackoverflow solution.
Diffstat:
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/content/2022-01-27-opencv-and-gtk.md b/content/2022-01-27-opencv-and-gtk.md
@@ -14,7 +14,9 @@ it originally had shown the following structure:
- image (GtkImage)
```
-but if you want to find the mouse location, put your GtkImage inside a GtkEventBox:
+According to <https://stackoverflow.com/a/24388310/189995> `GtkImage` does not
+generate events, so if you want to find the mouse location, put your
+`GtkImage` inside a `GtkEventBox`:
```
- window1 (GtkWindow)
@@ -24,11 +26,12 @@ but if you want to find the mouse location, put your GtkImage inside a GtkEventB
- image (GtkImage)
```
-and in `eventbox` set the `Common -> Events -> Pointer Motion` so you can add a handler to the `motion-notify-event` event.
+and in `eventbox` set the `Common -> Events -> Pointer Motion` so you can add
+a handler to the `motion-notify-event` event.
Now you can write your handler:
-```
+```python
def on_motion_notify_event(self, *args):
global current_mouse_location