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 matter what I try, cannot get this to work #11

Open
JRDK92 opened this issue May 9, 2024 · 1 comment
Open

No matter what I try, cannot get this to work #11

JRDK92 opened this issue May 9, 2024 · 1 comment

Comments

@JRDK92
Copy link

JRDK92 commented May 9, 2024

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

@EthanLowenthal
Copy link

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

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

2 participants