Im new to python and ttkbootstrap and I wanted to try out the style configuration. I wrote what the official documantation said to configure the sash of a paned window but gives me this error:
Traceback (most recent call last):
File “e:Progetti SoftwareEnviroBlendv0.4new_window”, line 69, in <module>
create_root()
File “e:Progetti SoftwareEnviroBlendv0.4new_window”, line 65, in create_root
style.configure(‘Sash’, sashrelief=’flat’)
File “c:UserspalomAppDataLocalProgramsPythonPython312Libsite-packagesttkbootstrapstyle.py”, line 516, in configure
ttkstyle = Bootstyle.update_ttk_widget_style(None, style)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “c:UserspalomAppDataLocalProgramsPythonPython312Libsite-packagesttkbootstrap ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
style.py”, line 1086, in name_to_method
func = getattr(StyleBuilderTTK, method_name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: type object ‘StyleBuilderTTK’ has no attribute ”
This is my test file
from tkinter import *
import ttkbootstrap as ttk
import config
def closeWindow():
config.programIsClosed=True
config.root.destroy()
def create_root():
config.root = ttk.Window(themename='darkly')
config.root.title('Enviroblend')
config.root.iconbitmap('icon.ico')
config.root.state('zoomed')
config.root.protocol('WM_DELETE_WINDOW', closeWindow)
config.width_screen = config.root.winfo_screenwidth()
config.height_screen = config.root.winfo_screenheight()
config.root.minsize(int(config.width_screen*0.6), int(config.height_screen*0.6))
config.top_frame = ttk.Frame(config.root, bootstyle='dark',
height=int(config.height_screen*0.025))
config.top_frame.pack(fill=X, expand=True, side=TOP, anchor=N)
main_frame = ttk.Frame(config.root, bootstyle='dark', height=int(config.height_screen*0.975))
main_frame.pack(fill=X, expand=True, side=BOTTOM, anchor=S)
style = ttk.Style()
style.configure('Sash', sashrelief='flat', gripcount=15)
style.configure('custom.TPanedwindow', background='red')
main_panel = ttk.PanedWindow(main_frame, orient=HORIZONTAL, width=int(config.width_screen),
height=int(config.height_screen*0.975),
style='custom.TPanedwindow')
main_panel.grid()
left_frame = ttk.Frame(main_frame, bootstyle='dark')
left_frame.grid(row=0, column=0)
right_frame = ttk.Frame(main_frame, bootstyle='dark')
right_frame.grid(row=0, column=1)
main_panel.grid_columnconfigure(0, weight=1)
main_panel.grid_columnconfigure(1, weight=8)
main_panel.add(left_frame, weight=1)
main_panel.add(right_frame, weight=8)
config.root.style.configure('long.TNotebook', tabposition='nw')
leftTabs = ttk.Notebook(left_frame, style='long.TNotebook')
leftTabs.pack(fill="both", expand=YES)
config.files_frame = ttk.Frame(leftTabs, bootstyle='dark')
config.files_frame.pack(fill="both", expand=True)
config.prefs_frame = ttk.Frame(leftTabs, bootstyle='dark')
config.prefs_frame.pack(fill="both", expand=True)
config.scenes_frame = ttk.Frame(leftTabs, bootstyle='dark')
config.scenes_frame.pack(fill="both", expand=True)
leftTabs.add(config.files_frame, text="Files", compound=LEFT)
leftTabs.add(config.prefs_frame, text="Preferiti")
leftTabs.add(config.scenes_frame, text="Scenes")
config.root.mainloop()
create_root()
Palo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.