New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
canvas.bbox returns None on 'hidden' items while coords doesn't #87628
Comments
canvas.bbox() should return a tuple containing values whether an item is hidden or not. canvax.coords() does return a tuple when an item is hidden. Steps to reproduce:
I need bbox to return a tuple containing values. The consequences is that the code must make the items temporarily visible before it can invoke the bbox function. This turning on and off creates flashing items in my program. Thanks in advance! |
What do you mean by "return nothing not even None"? Does it hang? |
No, not hang. It returns a NoneType. See this example: >>> x = canvas.bbox('tunnel')
>>> type(x)
<class 'NoneType'>
>>> |
This can be easily reproduced in Wish (8.6.11): % pack [canvas .c] I doubt this is a bug because the docs (https://www.tcl.tk/man/tcl8.6/TkCmd/canvas.htm#M36) say:
|
Thank you for your comments. Yes, I would doubt that, too. You would expect to get a bounding box regardless what state the canvas item are in. The only way to fix this (and I'm open to suggestions), is to create a (custom) function that calculate every object belonging to a specific tag and add/subtract the coordinates - this is cumbersome. |
... calculate the coordinates using the canvas.coords function |
(You don't use coords('tunnel') above because it only reports on the 'first' tagged object.) tkinter widget methods are generally thin wrappers around tk functions that translate between python objects and tk strings. I believe that this should be closed as '3rd party' or 'not a bug'. |
HI Terry, yes, that's completely true. But what I meant is I have to invoke coords on every item belonging to a tag and then perform some calculations to get the boundary box of all the items belonging to the item. Let's close this issue and I will knock on the door of the developers of Tk. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: