TomSchimansky / TomSchimansky/CustomTkinter
Textbox + Tab View Leads to Errors
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 13.6k
- Forks
- 1.2k
- PR merge metrics
- No merged PRs in 30d
Description
Adding a textbox to a tab view leads to AttributeError: 'CTkTextbox' object has no attribute '_x_scrollbar'.
Minimal example:
import customtkinter as ctk
def create_tab_view(parent):
tv = ctk.CTkTabview(parent, height=0)
tv.grid(sticky="nsew")
tv.add("A")
txt1 = ctk.CTkTextbox(tv.tab("A"))
txt1.grid(sticky="WE", padx=10, pady=0)
class main(ctk.CTk):
def __init__(self, parent=None):
super().__init__(parent)
btn = ctk.CTkButton(self, text="test")
btn.grid(row=0, column=0, sticky="nsew")
btn.configure(command=lambda: create_tab_view(self))
if __name__ == "__main__":
root = main()
root.mainloop()
Then just click the button.
In the __init__ of the CTKTextbox class, during the creation of the self._y_scrollbar, it calls self._canvas.update_idletasks() which for some reason ends up looking for the _x_scrollbar as well... which wasn't made yet.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in the CTkTextbox init method, focusing on creation of _y_scrollbar and the self._canvas.update_idletasks() call. Reproduce the issue with the minimal example by clicking the button, then verify that adding a textbox to a tab view no longer raises the _x_scrollbar AttributeError.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- desktop
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100