29 lines
707 B
Python
29 lines
707 B
Python
from __future__ import annotations
|
|
|
|
import tkinter as tk
|
|
from typing import Any, Callable
|
|
|
|
Action = Callable[[], None]
|
|
|
|
|
|
class PageContext:
|
|
def __init__(
|
|
self,
|
|
vars_: dict[str, tk.Variable],
|
|
texts: dict[str, tk.Text],
|
|
actions: dict[str, Action],
|
|
status_var: tk.StringVar | None = None,
|
|
runner: Any | None = None,
|
|
) -> None:
|
|
self.vars = vars_
|
|
self.texts = texts
|
|
self.actions = actions
|
|
self.status_var = status_var
|
|
self.runner = runner
|
|
|
|
def var(self, name: str) -> tk.Variable | None:
|
|
return self.vars.get(name)
|
|
|
|
def action(self, name: str) -> Action | None:
|
|
return self.actions.get(name)
|