TomSchimansky / CustomTkinter

A modern and customizable python UI-library based on Tkinter
MIT License
11.33k stars 1.07k forks source link

No CTkTreeView? #2357

Open adamtcdev opened 6 months ago

adamtcdev commented 6 months ago

CustomTkinter is a modern GUI that fits my project in my upcoming contest. But there's only one thing. I don't see any Treeview here. Anyone help? I already saw #524 but I don't know how to put the light/dark callback (AppearanceModeTracker.add(callback)) and use it with scale:

  File "g:\My Drive\TinEdu\v0.2-0304-beta\main.py", line 21, in __init__
    text_font = self._apply_appearance_mode(ThemeManager.theme["CTkLabel"]["font"])
                                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^
KeyError: 'font'

Anyone help? Please be quick because the contest is due in 2-3 weeks.

adamtcdev commented 6 months ago

https://stackoverflow.com/questions/78283327/is-there-any-ctktreeview-in-customtkinter

Akascape commented 6 months ago

@adamtcdev Why are you using self._apply_appearance_mode method? It is only for distinguishing colors which are in tuple form. You simply use text_font = ThemeManager.theme["CTkFont"]["family"]

JanPanthera commented 5 months ago

There is no official TreeView, but you can use my TreeView and use/adapt how you like it😹 https://github.com/JanPanthera/_GuiFramework/tree/main/GuiFramework/widgets/tree_view

Edit: Here an example where i use it https://github.com/JanPanthera/_AutodriveTranslationTool/blob/main/AutoDriveTranslationTool/src/components/dictionary_frame/dictionary_frame_gui.py

adamtcdev commented 5 months ago

There is no official TreeView, but you can use my TreeView and use/adapt how you like it😹 https://github.com/JanPanthera/_GuiFramework/tree/main/GuiFramework/widgets/tree_view

Edit: Here an example where i use it https://github.com/JanPanthera/_AutodriveTranslationTool/blob/main/AutoDriveTranslationTool/src/components/dictionary_frame/dictionary_frame_gui.py

I am not sure about it...

WARNING: Skipping GuiFramework as it is not installed.
Traceback (most recent call last):
  File "C:\Users\Adam\Desktop\_GuiFramework-main\setup.py", line 1, in <module>
    from setuptools import setup, find_packages
ModuleNotFoundError: No module named 'setuptools'
The system cannot find the file specified.
ERROR: Invalid requirement: 'dist\\'
Hint: It looks like a path. File 'dist\' does not exist.
Press any key to continue . . .
JanPanthera commented 5 months ago

yeah thats old, sorry the setup is not working instead you can use the update_package.bat, but this essential reinstalls every needed library, don't recommend that if you have made any changes to your ctk, if you haven't made any changes to customtkinter use it to install the GuiFramework in to your python shared libs. if someone wants to help me get a nice setup working, please help me xD

adamtcdev commented 5 months ago

https://packaging.python.org/en/latest/tutorials/packaging-projects/

adamtcdev commented 5 months ago

Oh, and did anyone know how to set the default font in CTk?

JanPanthera commented 5 months ago

Oh, and did anyone know how to set the default font in CTk?

you can do that by edit one of the default themes or by creating a custom theme and load that. here is a genereal guide, if you need more help i can try to help, its a bit since i played with custom themes ;-) Themes

adamtcdev commented 5 months ago

@adamtcdev Why are you using self._apply_appearance_mode method? It is only for distinguishing colors which are in tuple form. You simply use text_font = ThemeManager.theme["CTkFont"]["family"]

I am wondering if we could make a tuple like this.

text_font = ThemeManager.theme["CTkFont"]["family"]
text_size = ThemeManager.theme["CTkFont"]["size"]
text_tuple =  (text_font, text_size)

And put it in the Treeview:

treestyle.configure("Treeview", background=bg_color, foreground=text_color, fieldbackground=bg_color, font=text_tuple, borderwidth=0)
JanPanthera commented 5 months ago

you mean the tkinter treeview? I'm not sure how styling works in plain tkinter, but can take a look.It looks interesting