-
-
Notifications
You must be signed in to change notification settings - Fork 0
Variables
Shared values widgets can bind to. Change one variable, every bound widget updates live. Two scopes: global (project-wide) and local (per form).

F11 or View → Variables.
The window has two tabs:
| Tab | Scope | Visible to |
|---|---|---|
| Global | Whole project | Every widget in every form |
| Local: <form-name> | The active form only | Widgets inside that form |
The Local tab follows the active document — switch forms and the tab relabels.
| Type | Tk runtime | Use for |
|---|---|---|
str |
tk.StringVar |
text labels, entries, dropdown values |
int |
tk.IntVar |
counts, indices |
float |
tk.DoubleVar |
sliders, progress |
bool |
tk.BooleanVar |
switches, checkboxes |
Toolbar buttons in the Variables window. Renaming is safe — bindings reference the variable's UUID, not its name.
In the Properties panel, click the ◇ in a row's left gutter to bind that property to a variable. Bound rows show ◆ + an orange tint; the ✕ on the right unbinds.
The diamond's color tells you the scope:
- 🔵 Blue ◆ — bound to a global variable
- 🟠 Orange ◆ — bound to a local variable

Updates propagate live: typing into one Entry mirrors instantly into every Label / Switch / Slider sharing the variable.
Dragging or pasting a widget from one form to another can break local-variable bindings (the target form doesn't own those vars). When that happens, a Reparent Variables dialog opens with two choices:
| Source | Target |
|---|---|
| Keep the originals | Duplicate them in the target form (or reuse a same-name match) |
| Delete the originals | Unbind the moved widgets |
Cancel aborts the whole move.
Globals declare on the main window class as self.var_X; Toplevels read them as self.master.var_X. Locals declare on their owning class. Either way, every bound property becomes a shared tk.Variable — no extra wiring.
See also — Properties Panel · Exporting Code · Keyboard Shortcuts