Akascape / py-window-styles

Customize your python UI window with awesome pre-built windows 11 themes.
Creative Commons Zero v1.0 Universal
257 stars 15 forks source link

Cannot use this #2

Closed CodeSame closed 1 year ago

CodeSame commented 1 year ago

lib\site-packages\customtkinter\windows\widgets\core_widget_classes\ctk_base_class.py", line 111, in config raise AttributeError("'config' is not implemented for CTk widgets. For consistency, always use 'configure' instead.") AttributeError: 'config' is not implemented for CTk widgets. For consistency, always use 'configure' instead. When I try to activate the theme change to aero for the ctk.frame object, I get this error. This library looks just fine. If it could be used in my project it would be very good. The parts of the code I'm trying to integrate it through: class App(ctk.CTk): def init(self): super().init() root = ctk.CTk() ctk.set_default_color_theme("green") # Themes: "blue" (standard), "green", "dark-blue" ctk.set_appearance_mode("dark") self.title("") self.geometry(f"{520}x{235}")

Creating Main Frame

    self.main_frame = ctk.CTkFrame(self, width=510,height=290)
    self.main_frame.grid(row=0, column=10,columnspan=10, rowspan=10, ipadx=5, ipady=0, padx=0, pady=0, sticky="nw")
    self.main_frame.grid_rowconfigure(3, weight=1)
    self.cancel_button = ctk.CTkButton(self.main_frame, text = "Change",font=("Arial", 15),command=self.change_style('aero'))        
    self.cancel_button.grid(row=5, column=5,columnspan=2, padx=5, pady=10, rowspan=1)
def change_style(self,e):
    pywinstyles.apply_style(self.main_frame, e)
CodeSame commented 1 year ago

Etc error: \lib\site-packages\pywinstyles\py_win_style.py", line 71, in init window.config(bg="black")

Akascape commented 1 year ago

@CodeSame You can't use this directly on frames/widget. This is only for the root/toplevel windows. Refer the example

CodeSame commented 1 year ago

Thank you for your reply and this library. I have a feeling that this kind of UI is the future.

Akascape commented 1 year ago

@CodeSame This will work: pywinstyles.apply_style(self, e)

Akascape commented 1 year ago

I have a feeling that this kind of UI is the future.

Obviously, this feature will take your application to the next level. No one can even recognise that the UI is made with tkinter. I believe any type of user interface is possible with tkinter. You can explore more useful packages here https://github.com/Akascape/tkinter-toolkit