Forest-ttk-theme icon indicating copy to clipboard operation
Forest-ttk-theme copied to clipboard

No matter what I try, cannot get this to work

Open jsauerland opened this issue 9 months ago • 1 comments

Currently using azure theme azure.tcl, and swapped it for this. Cannot get it to work no matter what I try. I have it in the root directory of the python script, with folders theme > forest_light. I get this error:

_tkinter.TclError: no files matched glob pattern "*.png"

Python code:

  ```
  import tkinter as tk
  from tkinter import messagebox
  from tkinter import ttk
  
  # Get the path to the directory where the script is located
  script_dir = os.path.dirname(os.path.abspath(__file__))
  
  # Build the full path to the forest-light.tcl file
  tcl_path = os.path.join(script_dir, "forest-light.tcl")
  
  # Create the root window
  root = tk.Tk()
  root.title("windowtitle")
  
  
  
  
  # Pack a big frame so, it behaves like the window background
  big_frame = ttk.Frame(root)
  big_frame.pack(fill="both", expand=True)
  
  # Create a style
  style = ttk.Style(root)
  
  # Import the forest-light.tcl file using the full path
  root.tk.call("source", tcl_path)
  
  # Set the theme with the theme_use method
  style.theme_use("forest-light")
  
  
  # Create the main notebook
  main_notebook = ttk.Notebook(big_frame)
  main_notebook.pack(fill=tk.BOTH, expand=True)
  
  # Create the desktop view frame
  desktop_view = tk.Frame(main_notebook)
  main_notebook.add(desktop_view, text="Desktop")
  
  # Create the mobile view frame
  mobile_view = tk.Frame(main_notebook)
  main_notebook.add(mobile_view, text="Mobile")
  
  # Create the menu bar
  menubar = tk.Menu(root)
  root.config(menu=menubar)
  ```

Appears that even the example.py doesn't work from downloading the entire forest-ttk folder:

image

_File "c:\Users\josep\Downloads\Forest-ttk-theme-master\Forest-ttk-theme-master\example.py", line 29, in root.tk.call("source", "forest-dark.tcl") tkinter.TclError: couldn't read file "forest-dark.tcl": no such file or directory

jsauerland avatar May 09 '24 15:05 jsauerland

You need to include the "forest-dark" or "forest-light" directory alongside the file

EthanLowenthal avatar Jun 04 '24 21:06 EthanLowenthal