CustomTkinter icon indicating copy to clipboard operation
CustomTkinter copied to clipboard

No CTkTreeView?

Open adamtcdev opened this issue 1 year ago • 10 comments

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 avatar Apr 06 '24 05:04 adamtcdev

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

adamtcdev avatar Apr 06 '24 05:04 adamtcdev

@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"]

Akascape avatar Apr 06 '24 06:04 Akascape

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

JanPanthera avatar Apr 07 '24 11:04 JanPanthera

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 . . .

adamtcdev avatar Apr 07 '24 12:04 adamtcdev

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

JanPanthera avatar Apr 07 '24 14:04 JanPanthera

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

adamtcdev avatar Apr 07 '24 15:04 adamtcdev

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

adamtcdev avatar Apr 08 '24 13:04 adamtcdev

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

JanPanthera avatar Apr 08 '24 14:04 JanPanthera

@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)

adamtcdev avatar Apr 12 '24 09:04 adamtcdev

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

JanPanthera avatar Apr 12 '24 09:04 JanPanthera