0

To be quite specific in what I'm wanting to do...

I have a scrollable map on a canvas. I have zoom in/out capabilities. I want to place a cross hair/bullseye on top of the map so I know where I am going to be zooming in/out with high accuracy. I realize I could be more flexible and do it by locating the mouse pointer position and just have it zoom in/out based on where the mouse is at but I think given the magnitude of the project and the way it keeps evolving I better plan otherwise.

I'm thinking I would have to have two canvases on the screen to pull off what I'm wanting to do. That shouldn't be a problem. The problem...is it possible to make the top canvas trans????, is that parent or lucent...aka see-thru(I can never remember which is which, LOL:)) while still being able to see the cross hairs placed on the center of the top canvas. I don't think it could be done with only one canvas but I might be wrong.

Yes, this is a bit of a tricky question.

confused
  • 1,283
  • 6
  • 21
  • 37
  • Searching SO for `[tkinter] transparent canvas` gets 41 hits. At least the first 5 seem relevant. While the standard answer is 'no possible', this issue https://stackoverflow.com/questions/42869590/python-tkinter-canvas-transparent suggests that it is by fiddling with window manager attributes. I don't know if the code works on all systems, or for what you are doing. – Terry Jan Reedy Apr 09 '17 at 00:09

1 Answers1

0

No, it is not possible to have a transparent canvas.

If all you need is a crosshair, just draw one on the canvas. You can hide it temporarily while you zoom so that it doesn't get zoomed along with everything else.

Bryan Oakley
  • 370,779
  • 53
  • 539
  • 685
  • But I want the cross hairs to be stationary with scrollable map underneath. I don't want the cross hairs scrolling as well. Hence why I was asking the question. It sounds like I may just have to resort to using the mouse pointer to determine where the zoom is going to occur. Drats! – confused Apr 08 '17 at 19:47