# axoleov/desktop-pets architecture

> Architecture diagram of the GitHub repository axoleov/desktop-pets, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-23). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/axoleov/desktop-pets
- Repository: https://github.com/axoleov/desktop-pets

## Overview

Desktop Pet is a small Tkinter desktop companion. The workflow starts in main.py, creates DesktopPet, loads pet animation frames, and runs its event-driven behavior: mouse interactions and timers update movement, sleep, energy, and happiness, while messages appear in a speech bubble. The README also documents pet/size switching, feeding, and stats. Edges reflect calls shown in excerpts or documented behavior; omitted portions of pet_app.py limit detail about some transitions and event handlers.

Main entry points: [`pet_app.py`](https://github.com/axoleov/desktop-pets/blob/master/pet_app.py) (Pet controller), [`messages.py`](https://github.com/axoleov/desktop-pets/blob/master/messages.py) (Message pools), [`sprite_loader.py`](https://github.com/axoleov/desktop-pets/blob/master/sprite_loader.py) (Sprite frame loader), [`speech_bubble.py`](https://github.com/axoleov/desktop-pets/blob/master/speech_bubble.py) (Speech bubble window)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Desktop runtime"]
  node_entry["Application entry<br/>[main.py]"]
end

subgraph group_presentation["Pet presentation"]
  node_window["Pet window<br/>[pet_app.py]"]
  node_animation["Animation loop<br/>[pet_app.py]"]
  node_sprite_set["Sprite frame loader<br/>[sprite_loader.py]"]
  node_bubble["Speech bubble window<br/>[speech_bubble.py]"]
end

subgraph group_behavior["Behavior and interactions"]
  node_controller["Pet controller<br/>[pet_app.py]"]
  node_interactions["Mouse interactions<br/>[pet_app.py]"]
  node_behavior_tick["Behavior and stats<br/>[pet_app.py]"]
  node_movement["Hop and chase<br/>[pet_app.py]"]
  node_pet_options["Pet and size switching<br/>[pet_app.py]"]
  node_feeding_stats["Feed and stats<br/>[pet_app.py]"]
end

subgraph group_content["Pet content"]
  node_sprite_assets["Tiny Pets sprites"]
  node_message_pools["Message pools<br/>[messages.py]"]
end

node_user(("Desktop user"))

node_user -->|"starts app"| node_entry
node_entry -->|"creates pet"| node_controller
node_controller -->|"sets up"| node_window
node_controller -->|"loads frames"| node_sprite_set
node_sprite_set -->|"reads sheets"| node_sprite_assets
node_controller -->|"creates bubble"| node_bubble
node_user -->|"clicks or drags"| node_interactions
node_interactions -.->|"updates state"| node_behavior_tick
node_behavior_tick -.->|"starts movement"| node_movement
node_behavior_tick -->|"selects chatter"| node_message_pools
node_interactions -->|"selects reactions"| node_message_pools
node_movement -->|"selects reactions"| node_message_pools
node_interactions -->|"switches pet or size"| node_pet_options
node_interactions -->|"feeds or requests stats"| node_feeding_stats
node_feeding_stats -->|"selects feed text"| node_message_pools
node_pet_options -->|"reloads frames"| node_sprite_set
node_animation -->|"gets frames"| node_sprite_set
node_controller -->|"schedules frames"| node_animation
node_controller -->|"schedules ticks"| node_behavior_tick
node_controller -->|"shows text"| node_bubble
node_message_pools -.->|"provides text"| node_bubble

click node_entry "https://github.com/axoleov/desktop-pets/blob/master/main.py"
click node_controller "https://github.com/axoleov/desktop-pets/blob/master/pet_app.py"
click node_window "https://github.com/axoleov/desktop-pets/blob/master/pet_app.py"
click node_animation "https://github.com/axoleov/desktop-pets/blob/master/pet_app.py"
click node_interactions "https://github.com/axoleov/desktop-pets/blob/master/pet_app.py"
click node_behavior_tick "https://github.com/axoleov/desktop-pets/blob/master/pet_app.py"
click node_movement "https://github.com/axoleov/desktop-pets/blob/master/pet_app.py"
click node_pet_options "https://github.com/axoleov/desktop-pets/blob/master/pet_app.py"
click node_feeding_stats "https://github.com/axoleov/desktop-pets/blob/master/pet_app.py"
click node_sprite_set "https://github.com/axoleov/desktop-pets/blob/master/sprite_loader.py"
click node_sprite_assets "https://github.com/axoleov/desktop-pets/tree/master/assets/Tiny%20Pets"
click node_message_pools "https://github.com/axoleov/desktop-pets/blob/master/messages.py"
click node_bubble "https://github.com/axoleov/desktop-pets/blob/master/speech_bubble.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_entry,node_user toneBlue
class node_window,node_animation,node_sprite_set,node_bubble toneAmber
class node_controller,node_interactions,node_behavior_tick,node_movement,node_pet_options,node_feeding_stats toneMint
class node_sprite_assets,node_message_pools toneRose
```

## Components

### Desktop runtime

- [Application entry](https://github.com/axoleov/desktop-pets/blob/master/main.py): `main.py`

### Pet presentation

- [Pet window](https://github.com/axoleov/desktop-pets/blob/master/pet_app.py): `pet_app.py`
- [Animation loop](https://github.com/axoleov/desktop-pets/blob/master/pet_app.py): `pet_app.py`
- [Sprite frame loader](https://github.com/axoleov/desktop-pets/blob/master/sprite_loader.py): `sprite_loader.py`
- [Speech bubble window](https://github.com/axoleov/desktop-pets/blob/master/speech_bubble.py): `speech_bubble.py`

### Behavior and interactions

- [Pet controller](https://github.com/axoleov/desktop-pets/blob/master/pet_app.py): `pet_app.py`
- [Mouse interactions](https://github.com/axoleov/desktop-pets/blob/master/pet_app.py): `pet_app.py`
- [Behavior and stats](https://github.com/axoleov/desktop-pets/blob/master/pet_app.py): `pet_app.py`
- [Hop and chase](https://github.com/axoleov/desktop-pets/blob/master/pet_app.py): `pet_app.py`
- [Pet and size switching](https://github.com/axoleov/desktop-pets/blob/master/pet_app.py): `pet_app.py`
- [Feed and stats](https://github.com/axoleov/desktop-pets/blob/master/pet_app.py): `pet_app.py`

### Pet content

- [Tiny Pets sprites](https://github.com/axoleov/desktop-pets/tree/master/assets/Tiny%20Pets): `assets/Tiny Pets`
- [Message pools](https://github.com/axoleov/desktop-pets/blob/master/messages.py): `messages.py`

### Other components

- **Desktop user**

## Connections

- Desktop user → Application entry: starts app (evidence: `README.md`)
- Application entry → Pet controller: creates pet (evidence: `main.py`)
- Pet controller → Pet window: sets up (evidence: `pet_app.py`)
- Pet controller → Sprite frame loader: loads frames (evidence: `pet_app.py`)
- Sprite frame loader → Tiny Pets sprites: reads sheets (evidence: `sprite_loader.py`)
- Pet controller → Speech bubble window: creates bubble (evidence: `pet_app.py`)
- Desktop user → Mouse interactions: clicks or drags (evidence: `README.md`)
- Mouse interactions → Behavior and stats: updates state (evidence: `pet_app.py`)
- Behavior and stats → Hop and chase: starts movement (evidence: `pet_app.py`)
- Behavior and stats → Message pools: selects chatter (evidence: `pet_app.py`)
- Mouse interactions → Message pools: selects reactions (evidence: `pet_app.py`)
- Hop and chase → Message pools: selects reactions (evidence: `pet_app.py`)
- Mouse interactions → Pet and size switching: switches pet or size (evidence: `pet_app.py`)
- Mouse interactions → Feed and stats: feeds or requests stats (evidence: `pet_app.py`)
- Feed and stats → Message pools: selects feed text (evidence: `pet_app.py`)
- Pet and size switching → Sprite frame loader: reloads frames (evidence: `pet_app.py`)
- Animation loop → Sprite frame loader: gets frames (evidence: `pet_app.py`)
- Pet controller → Animation loop: schedules frames (evidence: `pet_app.py`)
- Pet controller → Behavior and stats: schedules ticks (evidence: `pet_app.py`)
- Pet controller → Speech bubble window: shows text (evidence: `pet_app.py`)
- Message pools → Speech bubble window: provides text
