-
-
Notifications
You must be signed in to change notification settings - Fork 0
Scripts Panel
One floating panel listing every
.pyfile in the active page. Open a window's behavior file, or add a shared library module (helpers.py,api.py, sub-packages) that any behavior file in the same page can import.
| How | Notes |
|---|---|
F6 |
Keyboard shortcut |
| View → Scripts | Menu toggle |
| Scripts button on the workspace strip | Sits to the left of Data at the top of the canvas |
The panel is scoped to the active page. Switching pages refreshes the list. Pages do not share scripts — each page exports as an independent .py, so a project-wide layer would break the per-page export.
| Kind | Visual | Origin | Actions |
|---|---|---|---|
| Behavior file | Orange color + (window) suffix |
Auto-created when you add a window | Open in editor only — rename / delete go through the window chrome |
| Library script | Default color | You add it from the panel toolbar | Open in editor, Rename, Delete |
| Sub-folder | Light blue | Created from the [[Assets Panel | Assets-Panel]] |
| Element | Action |
|---|---|
| + Add script | Prompt for a name (helpers.py, services/auth.py, …). Creates the file plus any missing parent folders + __init__.py chain. |
The panel auto-refreshes whenever it regains focus, so files you create, rename, or delete in an external editor (VS Code, Notepad++, file explorer, …) appear as soon as you click back into CTkMaker. No manual refresh button.
| Row | Menu |
|---|---|
| Library script | Open in editor • Rename… • Delete |
| Behavior file | Open in editor only |
| Sub-folder | (no menu — manage in Assets) |
Double-click or Enter — opens in your configured editor (Settings → Editor). Same chain as Event Handlers uses: VS Code → Notepad++ → IDLE fallback.
Delete sends the file to the OS recycle bin (Send2Trash) — recoverable.
A library script is any .py file in the page's scripts folder whose name does NOT match a window's behavior file slug. Use them for shared helpers across the windows on a single page.
<project>/assets/scripts/<page>/
├── <window>.py Behavior file — auto-managed
├── helpers.py Library script — manual
├── api.py Library script — manual
└── services/
├── __init__.py
└── auth.py Library script in a sub-package
From any behavior file in the same page:
from . import helpers
from .services import auth
class LoginPage:
def on_submit(self):
if helpers.validate_email(self.email_entry.get()):
auth.sign_in(...)Survives export — when you export the page, the whole assets/scripts/<page>/ folder is copied next to the output .py, so the same relative import resolves at runtime.
Variables follow the same rule: Global = page-scope, not project-scope. Each page exports independently, so cross-page sharing would force every page to carry the same code at runtime. If two pages need the same helper today, copy it into each page.
- Naming a library file the same as a window slug (
login.pywhen a window is namedLogin) is rejected — it would shadow the behavior file. - The
+ Add scriptprompt accepts paths (services/auth.py) — sub-folders are created automatically with empty__init__.pyfiles so the import resolves. - A library script is a normal
.py— no decorator, no registration, no contract. Just functions, classes, constants. Behavior files import them like any other Python module.
See also — Event Handlers · Assets Panel · Exporting Code · Variables · Settings