Closed DIY-TECH-HACKER closed 4 months ago
@DIY-TECH-HACKER Not a ctktable issue, this behavior is shown with all widgets inside scrollable frame. I know you are expecting it to stretch after full screen, but it is an issue with ctk scrollable frame instead. Try with a button instead, it will show the same behavior.
@Akascape Thank you for the info. But do you know anyway to stretch at full screen I need to view the data in the table when is window size is reduced
@DIY-TECH-HACKER Ok I will try to find a workaround when the scrollbar reaches full size
@Akascape Thanks a lot
@DIY-TECH-HACKER Here is an attempt to make dynamic resizing in scrollableframe:
def dynamic_resize(scrollable_frame):
""" stretch the frame content when it reaches full size """
scrollable_frame.update()
original_width = scrollable_frame.winfo_width()
def resize_event(event):
current_width = scrollable_frame._parent_frame.winfo_width()
if current_width>original_width:
scrollable_frame._parent_canvas.itemconfig(scrollable_frame._create_window_id,
width=current_width)
scrollable_frame._parent_frame.bind("<Configure>", resize_event, add="+")
scrframe = customtkinter.CTkScrollableFrame(root, orientation="horizontal")
scrframe.pack(expand=True, fill="both")
dynamic_resize(scrframe) # just add this line
...
Let me know if it's working... (also make sure the table/frame content is expandable)
@Akascape It is properly expending with CTkScrollableFrame but the text is cramped when the window size is reduced also getting error while trying to use the function with CTkXYFrame.
This is the error 👇👇👇👇
Edit:- I have fixed the text cramping issue
@DIY-TECH-HACKER It's not for xyframe, because some variable names are different in xyframe.
I tried to create a separate function for CTkXYFrame by replacing the variable name from the function you give with the variable name from CTkXYFrame but got stuck and I don't have enough knowledge to solve the rest of the error.
This is what I could change 👇👇👇
def Dynamic_Frame_Resizer_CTkXYFrame(Scrollable_Frame):
Scrollable_Frame.update()
Original_Width = Scrollable_Frame.winfo_width()
def Resize_Event(event):
Current_Width = Scrollable_Frame.parent_frame.winfo_width()
if Current_Width > Original_Width:
Scrollable_Frame.xy_canvas.itemconfig(Scrollable_Frame._create_window_id,width=Current_Width)
Scrollable_Frame.parent_frame.bind("<Configure>", Resize_Event, add="+")
And this is the remaining error I got 👇👇👇👇
Exception in Tkinter callback
Exception in Tkinter callback
Exception in Tkinter callback
Exception in Tkinter callback
Exception in Tkinter callback
Exception in Tkinter callback
Exception in Tkinter callback
Exception in Tkinter callback
Exception in Tkinter callback
Exception in Tkinter callback
Exception in Tkinter callback
Exception in Tkinter callback
Exception in Tkinter callback
Exception in Tkinter callback
Exception in Tkinter callback
Exception in Tkinter callback
Traceback (most recent call last):
File "D:(c drive)\Python\Lib\tkinter__init.py", line 1948, in call
return self.func(args)
^^^^^^^^^^^^^^^^
File "d:\INTELLECT 2.0\Intellect 2.0 copy 2.py", line 121, in Resize_Event
Scrollable_Frame.xy_canvas.itemconfig(Scrollable_Frame._create_window_id,width=Current_Width)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'CTkXYFrame' object has no attribute '_create_window_id'
Exception in Tkinter callback
Traceback (most recent call last):
File "D:(c drive)\Python\Lib\tkinter__init.py", line 1948, in call__
return self.func(args)
^^^^^^^^^^^^^^^^
File "d:\INTELLECT 2.0\Intellect 2.0 copy 2.py", line 121, in Resize_Event
Scrollable_Frame.xy_canvas.itemconfig(Scrollable_Frame._create_window_id,width=Current_Width)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'CTkXYFrame' object has no attribute '_create_window_id'
Exception in Tkinter callback
Traceback (most recent call last):
File "D:(c drive)\Python\Lib\tkinter__init.py", line 1948, in call__
return self.func(*args)
^^^^^^^^^^^^^^^^
File "d:\INTELLECT 2.0\Intellect 2.0 copy 2.py", line 121, in Resize_Event
Scrollable_Frame.xy_canvas.itemconfig(Scrollable_Frame._create_window_id,width=Current_Width)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'CTkXYFrame' object has no attribute '_create_window_id'
Traceback (most recent call last):
File "D:(c drive)\Python\Lib\tkinter\init.py", line 1948, in call__
return self.func(*args)
^^^^^^^^^^^^^^^^
File "D:(c drive)\Python\Lib\site-packages\CTkXYFrame\ctk_xyframe.py", line 40, in
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "d:\INTELLECT 2.0\Intellect 2.0 copy 2.py", line 270, in
@DIY-TECH-HACKER There was a thing missing in xyframe, I added it now. update and test this:
def dynamic_resize(xy_frame):
""" stretch the frame content when it reaches full size """
xy_frame.update()
original_width = xy_frame.winfo_width()
def resize_event(event):
current_width = xy_frame.parent_frame.winfo_width()
if current_width>original_width:
xy_frame.xy_canvas.itemconfig(xy_frame.window_id, width=current_width)
xy_frame.parent_frame.bind("<Configure>", resize_event, add="+")
...
dynamic_resize(xy_frame)
Still getting error after updating and using the given function
Error 👇👇👇👇👇
Exception in Tkinter callback
Exception in Tkinter callback
Exception in Tkinter callback
Exception in Tkinter callback
Exception in Tkinter callback
Exception in Tkinter callback
Exception in Tkinter callback
Exception in Tkinter callback
Exception in Tkinter callback
Exception in Tkinter callback
Exception in Tkinter callback
Exception in Tkinter callback
Exception in Tkinter callback
Exception in Tkinter callback
Exception in Tkinter callback
Traceback (most recent call last):
File "D:(c drive)\Python\Lib\tkinter__init.py", line 1948, in call__
return self.func(*args)
^^^^^^^^^^^^^^^^
File "D:(c drive)\Python\Lib\site-packages\CTkXYFrame\ctk_xyframe.py", line 40, in
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "d:\INTELLECT 2.0\Intellect 2.0 copy 2.py", line 283, in
@DIY-TECH-HACKER Try to specify height and width in xyframe, maybe increase the height/width. This is actually a bug I found.
I increased the height and width now it is working perfectly
Thanks for your help......
Hi @Akascape I am using CTkTable inside CTkScrollableFrame in horizontal orientation so that I can view the table clearly when the window size is small(When I split the screen with two applications).
The problem is that when I view it when the window is small the CTkTable fits perfectly in CTkScrollableFrame but when the window is in fullscreen there is a massive gap in the frame and it is not filling the frame( pls look at the image below ).
Also having the same issue while using CTkXYFrame
THE CODE 👇👇👇👇👇👇
MySQl_Creadentials_Frame = customtkinter.CTkScrollableFrame(master=Main_Frame, width=690, height=190,corner_radius=10,orientation="horizontal") MySQl_Creadentials_Frame.grid(row= 6,column= 0,padx= (10,0),pady= (0,0),sticky="nsew",columnspan=2) MySQl_Creadentials_Frame.columnconfigure((0),weight=1) MySQl_Creadentials_Frame.rowconfigure((0),weight=1)
SCREENSHOTS 👇👇👇👇👇
When window is small
When window is fullscreen
Thanks in advance.........