commit fda31494b040375309c9db24905a845ce43f1b99 parent 1e18fd3139d4fb2e1726f5f3b0d3757032a14e87 Author: Yuval Langer <yuval.langer@gmail.com> Date: Thu, 27 Jan 2022 09:17:47 +0200 Put the handler inside the handler class, like it was shown in the original tutorial. Diffstat:
M | content/2022-01-27-opencv-and-gtk.md | | | 14 | +++++++++----- |
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/content/2022-01-27-opencv-and-gtk.md b/content/2022-01-27-opencv-and-gtk.md @@ -32,10 +32,14 @@ a handler to the `motion-notify-event` event. Now you can write your handler: ```python -def on_motion_notify_event(*args): - global current_mouse_location - - event = args[1] +class Handler: + … + … + … + def on_motion_notify_event(*args): + global current_mouse_location - current_mouse_location = event.x, event.y + event = args[1] + + current_mouse_location = event.x, event.y ```