TomSchimansky / TomSchimansky/CustomTkinter

ScrollableFrame items not updated on TabView tab change

Open
#2,065 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
13.6k
Forks
1.2k
PR merge metrics
No merged PRs in 30d

Description

When I want to use a CTkScrollableFrame inside a CTkTabview tab, then on the first couple of clicks it works fine. (the elements in my frame are appearing immediately after changing tabs).
But after a short while, when I change the tab, the frame contents are not rendered unless I move the cursor/take the focus away from the selected tab.
Here is a short code which demonstrates the issue:

from customtkinter import *

class MyFrame(CTkScrollableFrame):
    def __init__(self, master, **kwargs):
        super().__init__(master, **kwargs)

        self.label = CTkLabel(self, text="test")
        self.label.grid(row=0, column=0, padx=20)


class App(CTk):
    def __init__(self):
        super().__init__()

        self.notebook = CTkTabview(master=self)
        self.notebook.columnconfigure(0, weight=1)
        self.notebook.grid(row=0, column=0, pady=(10, 20), padx=(70,70))

        days = ["Monday", "Tuesday", "Wednesday"]

        for day in days:
            self.notebook.add(day)
            my_frame = MyFrame(master=self.notebook.tab(day), width=300, height=200)
            my_frame.grid(row=0, column=0, padx=20, pady=20)



app = App()
app.mainloop()

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Run the provided Python reproduction with CTkTabview and CTkScrollableFrame, then inspect the implementations of those two classes and their tab-change handling. The fix is done when the frame contents render immediately after repeated tab changes without moving the cursor or focus away from the selected tab.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
desktop, frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.