Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No CTkTreeView? #2357

Open
adamtcdev opened this issue Apr 6, 2024 · 10 comments
Open

No CTkTreeView? #2357

adamtcdev opened this issue Apr 6, 2024 · 10 comments

Comments

@adamtcdev
Copy link

adamtcdev commented Apr 6, 2024

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
Copy link
Author

@Akascape
Copy link

Akascape commented Apr 6, 2024

@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
Copy link

JanPanthera commented Apr 7, 2024

@adamtcdev
Copy link
Author

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
Copy link

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
Copy link
Author

@adamtcdev
Copy link
Author

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

@JanPanthera
Copy link

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
Copy link
Author

@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
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants