CustomTkinter icon indicating copy to clipboard operation
CustomTkinter copied to clipboard

CTkScrollableFrame incompatible with tkinterweb.HtmlFrame

Open AssimDelteil opened this issue 1 year ago • 3 comments

Hello, I have an issue on my project where I use both a CTkScrollableFrame and a HtmlFrame from tkinterweb. When I scroll on my CTkScrollableFrame, an error message is displayed but nothing breaks (the scroll is still happening and the program is not crashing). The CTkScrollableFrame just need to be instanciated for this to happen, no need to display it.

Exception in Tkinter callback
Traceback (most recent call last):
  File "C:\Users\<user>\AppData\Local\Programs\Python\Python311\Lib\tkinter\__init__.py", line 1948, in __call__
    return self.func(*args)
  File "C:\Users\<user>\AppData\Local\Programs\Python\Python311\Lib\site-packages\customtkinter\windows\widgets\ctk_scrollable_frame.py", line 248, in _mouse_wheel_all
    if self.check_if_master_is_canvas(event.widget):
  File "C:\Users\<user>\AppData\Local\Programs\Python\Python311\Lib\site-packages\customtkinter\windows\widgets\ctk_scrollable_frame.py", line 280, in check_if_master_is_canvas
    elif widget.master is not None:
AttributeError: 'str' object has no attribute 'master'

Here is a sample code to reproduce the issue:

import tkinter as tk
import customtkinter
from tkinterweb import HtmlFrame

root = tk.Tk()

htmlBodyFrame = HtmlFrame(root, messages_enabled = False)
htmlBodyFrame.load_html('\<p\>This is an HTML rendering frame\</p\>') 
htmlBodyFrame.pack() 

scrollableFrame = customtkinter.CTkScrollableFrame(root)

root.mainloop()

Package version:

customtkinter==5.2.2
tkinterweb==3.23.10

Could you please look into this ? Regards,

PS: first time opening a github issue, sorry if i something is missing.

AssimDelteil avatar Jul 14 '24 14:07 AssimDelteil