Tic Tac Toe¶
Classic two-player game built with UI widgets.
▶ Run in browserTags: game ui button grid signals game-state
A clean Tic Tac Toe entirely composed of SimVX UI widgets (Button,
Label, GridContainer, VBoxContainer) with no custom draw code.
Button signals wire directly to game logic; cells re-render via runtime
property changes.
This main.py is a thin entry that imports the game from the sibling
game.py so the existing menu.py, demo.py, and web.py modules
continue to resolve from game import ….
Source¶
1"""Tic Tac Toe: Classic two-player game built with UI widgets.
2
3# /// simvx
4# tags = ["game", "ui", "button", "grid", "signals", "game-state"]
5# web = { width = 400, height = 550, root = "TicTacToeApp" }
6# ///
7
8A clean Tic Tac Toe entirely composed of SimVX UI widgets (`Button`,
9`Label`, `GridContainer`, `VBoxContainer`) with no custom draw code.
10Button signals wire directly to game logic; cells re-render via runtime
11property changes.
12
13This `main.py` is a thin entry that imports the game from the sibling
14`game.py` so the existing `menu.py`, `demo.py`, and `web.py` modules
15continue to resolve `from game import …`.
16"""
17
18from game import TicTacToeApp # noqa: F401 (re-exported for the web exporter)
19
20from simvx.graphics import App
21
22
23def main() -> None:
24 App(title="Tic Tac Toe", width=400, height=550).run(TicTacToeApp())
25
26
27if __name__ == "__main__":
28 main()