-
-
Notifications
You must be signed in to change notification settings - Fork 0
Exporting Code
Generate a runnable Python file from your design.
File → Export Python — pick a destination .py (or .zip).
The export writes a single Python file alongside an assets/ folder for any images/fonts your design references.
| Document | Becomes |
|---|---|
| First document |
ctk.CTk subclass — the __main__ entry point |
| Other documents |
ctk.CTkToplevel subclasses — open from your code with MyDialog(self)
|
If your design uses the enhanced dropdown, a scrollable_dropdown.py helper is copied next to the output file.
Properties bound to a Variables become shared tk.StringVar / IntVar / DoubleVar / BooleanVar instances at the top of the generated class — clean two-way data flow with no extra wiring.
Forms with bound Event Handlers also import their behavior file:
from assets.scripts.<page>.<window> import <Class>Page
…
self._behavior = <Class>Page()
self._behavior.setup(self)Each event becomes either:
-
command=self._behavior.method_name(single action) orcommand=lambda: (self._behavior.m1(), self._behavior.m2())(multi-action chain) — forcommand=events -
widget.bind(seq, self._behavior.method_name, add="+")— for bind-style events (<Return>,<FocusOut>, …)
The assets/scripts/ folder is copied next to the output .py (or zipped with it) — this includes both the per-window behavior files and any library scripts (helpers.py, sub-packages, etc.) that behavior files import.
- Open in editor after export
- Run preview after export
-
Export as
.ziparchive (Python file +assets/+ helper, all in one)
See also — Windows and Dialogs · Event Handlers · Python Import