Get upper left and down right coordinates from zoomed image
-
@jsulm I find it more easy to program it with methods.
So the idea is that I call a "method_1" when the button is pressed. This "method_1" calls an instance of the "class_1". "Class_1" includes the code for area selection. The problem is that when I run the pyqt5 code , only the "class_1" is executed!!!@john_hobbyist said in Get upper left and down right coordinates from zoomed image:
This "method_1" calls an instance of the "class_1"
How is this related to functions inside a method?!
If you want to call a method on a class then you need an instance of that class. -
@john_hobbyist said in Get upper left and down right coordinates from zoomed image:
This "method_1" calls an instance of the "class_1"
How is this related to functions inside a method?!
If you want to call a method on a class then you need an instance of that class.This post is deleted! -
This post is deleted!
-
After a lot of google searching and experiments I resulted in this concept:
class area: def __call__(self): x = 0, y = 0 # step 1 def read_cursor(action): x = read_x y = read_y . . . def do_something(action): . . .The problem that x,y are not being updated when I move mouse. How do I pass the new updated mouse coordinates from read_cursor() function to ones in # step 1??
-
You should provide a minimal runnable script that shows what you want to do with that piece of code.
-
My code above is very simple. I need only to update x, y values (#step1), if someone can help me...
-
Your code is incomplete and without context.
It does not allow to understand the logic you want to implement. -
The idea is that I have a function embedded to another function. Generally speaking, how can I pass values from the inner function to the outer function?
-
The idea is that I have a function embedded to another function. Generally speaking, how can I pass values from the inner function to the outer function?
@john_hobbyist said in Get upper left and down right coordinates from zoomed image:
how can I pass values from the inner function to the outer function?
By returning them
def __call__(self): def read_cursor(action): x = read_x y = read_y return (x, y) x, y = read_cursor(action)I still don't understand why you need nested functions...
-
@jsulm I need to get the returned values when I call the function like this:
frame.bind("<Button-1>", callback)So, in the position of
def read_cursorput the
def callbackfunction
Please look here: https://web.archive.org/web/20201111211515id_/https://effbot.org/tkinterbook/tkinter-events-and-bindings.htm
How can I achieve that? I use tkinter auxiliary to PyQt5
-
Why are you needing to add tkinter to your Qt application ?
-
@SGaist I tried qrubberband in the past (https://stackoverflow.com/questions/13840289/how-to-use-qrubberband-with-qrect-class-in-pyqt and https://stackoverflow.com/questions/34220275/how-to-select-a-region-with-qrubberband-on-a-qlabel-like-in-ksnapshot) but it didn't work! Also I need to get coordinates of the corners of the selected area and tkinter is very easy on this...
-
This post is deleted!
-
Ok, never mind, I solved it 80%. Another point, in the previously mentioned code (https://github.com/Axel-Erfurt/OrthoViewLite/blob/main/OrthoViewLite.py) in which part does the "store image" button be related? I have put "prints" in the entire code, nowhere I see an action on prints, when I zoom in and store the current image...
-
Alternatively, how can I have access to the current image each time that it is depicted? so that when I zoom the image with zoom button to get the current zoomed image and not the initial one that I have loaded when I run the app... I am always referring to the above mentioned github code... Anyone???