I have created a scrollable canvas. In which a frame window is there and there are many canvases in it which shows data in form of various labels? Actually I have created everything like frame configuration to update canvas scollregion but I sometimes randomly gets a bug that is when I destroy a canvas in a frame then sometimes the size of scrollbar adjust automatically but sometimes it doesn't change and scollbar shows a region with no data a large blank space at the bottom is generated sometimes and also when I cleared the frame window completely by destroying all of its children widgets then even I checked on console by print statements that everything is cleared but still the results on gui tkinter windows are still there till I switch the page and it is also occuring randomly why? Sometimes everything goes as planned but sometimes not can you figure why?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
There may be many problems, but it seems that the most significant is that you are creating two canvases but only saving a reference to the last one that was created.
At startup self.canvas
will point to the first canvas. When you click on "Detail Box2", self.canvas
is reset to be a new canvas. You no longer have a reference to the first canvas. From that point on, any time you do anything with self.canvas
, it's only doing it to the second canvas.
Until you fix that, I don't think it's possible for anything else to work correctly.