Dear All,
I am very beginner in python and wxpython and working on one project where i need to get the actual image coordinate when i click anywhere over the image(jpg). I have read lot of articles with respect to how to get it work but somehow nothing seems to work.
I tried following code also that i found somewhere on mailing list, but it also doesnt work -
ctrl_pos = event.GetPosition()
print("ctrl_pos: " + str(ctrl_pos.x) + ", " + str(ctrl_pos.y))
pos = self.bitmapImageFile.ScreenToClient(ctrl_pos)
print "pos relative to screen top left = ", pos
screen_pos = self.GetScreenPosition()
print "screen position - x, y: " ,screen_pos
relative_pos_x = pos[0] + screen_pos[0]
relative_pos_y = pos[1] + screen_pos[1]
print "pos relative to image top left = ", relative_pos_x, relative_pos_y
I am staticbitmap inside a scrollwindow to display the images. One problem is that the image doest stay attached to scrollwindow always, means when i maximize or stretch the frame the image gets align in the center and when i select a new image it comes align left to scrollwindow. So it changes the image coordinates.
I am attaching my code. I desperately need help. In my program, there is one frame and one menu “Open->Load Images”. On clicking “Load images” a dialogue appears with directory picker. I choose a image directory and images gets loaded in a list inside a frame. I click on image name and it gets displayed in scrollwindow.
What i want is that, whereever the image is displayed inside the scrollwindow, left aligned or center aligned, i should be able to get actual image coordinates of mouse pointer.
By the way i am using wxformbuilder to prepare all the GUIs.
Thanks in advance, please help.
Gaurav
noname.py (6.27 KB)