Hello,
I need to create a gui which has an image and some controllers.
I’m using Gtk and ImageView, my quastion is, how can i get the image pixle that the mouse courser is clicked on?
Thanks in ahead
Hello,
I need to create a gui which has an image and some controllers.
I’m using Gtk and ImageView, my quastion is, how can i get the image pixle that the mouse courser is clicked on?
Thanks in ahead
I don’t know, but I’d look at GtkReactive’s docs.
hi, after some sourcing I found the solution:
# loading the needed pkg
using ImageView, TestImages
# choosing image to show
img = float.(testimage("lighthouse"))
s = imshow(img)
# this is the main idea, in the s object under the dictionary key "gui" then "canvas" there is a
# mouse Signal object which has several actions, one of them is buttonpress, in this example
# i map the Signal when the mouse button pressed to the println function which print the
# mouse [x,y] position
mouse_pos = map(d->println("x = $(float(d.position.x)), y = $(float(d.position.y))"),s["gui"]["canvas"].mouse.buttonpress)
I was reading Mackie’s docs, and it also has this feature: https://makie.juliaplots.org/stable/interaction.html#Interaction-using-the-mouse
I’m familiar with the Makie interaction with mouse, but unforchenetly it lackes the other gui features that Gtk has so i can’t use it.
As i note earlier, i’m using Gtk and there for i need to use ImagView with it.