Skip to content

CTkScrollableFrame content visibility issue on MacOS #2792

@qwertyzen

Description

@qwertyzen

This is an issue that happens on MacOS and not on Windows or Linux. The following code reproduces the issue.

The toplevel window has a CTkScrollableFrame containing several labels. The toplevel window is shown in three different ways

  • CTkButton click in the root window
  • tk.Menu entry in the app menu
  • Keyboard function key F1

When I click the button the toplevel window shows correctly. The issue occurs with the other two methods where the toplevel window appears, but the scrollable frame is empty. The scrollbar shows but none of the content. The content in the scrollable frame appears if

  • mouse scroll inside the frame, or
  • mouse pointer over the scroll bar

Adding root.update() or tl.update() after tl.deiconify() does not show the content either. update_idletasks() also does not make them appear.

import customtkinter as ctk
import tkinter as tk

def hide_tl():
    tl.withdraw()
    root.focus()

def show_tl():
    tl.deiconify()
    # tl.update()

root = ctk.CTk()
btn = ctk.CTkButton(root, command=show_tl)
btn.pack(padx=40, pady=40)
root.bind('<F1>', lambda x: show_tl())

tl = ctk.CTkToplevel(root)
tl.protocol('WM_DELETE_WINDOW', hide_tl)
sfr = ctk.CTkScrollableFrame(tl)
sfr.pack(fill='both', expand=True)

for i in range(30):
    ctk.CTkLabel(sfr, text=f'Label {i}').pack()

menu = tk.Menu(root)
root.configure(menu=menu)
show = tk.Menu(menu)
show.add_command(label='show tl', command=show_tl)
menu.add_cascade(label='my menu', menu=show)

root.mainloop()

Note: This occurs only on MacOS. It shows correctly as expected on Windows and Ubuntu 24.04. I am testing on MacOS Tahoe 26.2.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions