Metadata-Version: 2.4
Name: draw-win32
Version: 0.1.0
Summary: A lightweight Win32 drawing library for Python
License-Expression: MIT
Keywords: drawing,graphics,win32,gdi,game-development
Classifier: Development Status :: 3 - Alpha
Classifier: Operating System :: Microsoft :: Windows
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Multimedia :: Graphics
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: keyboard>=0.13.5
Dynamic: license-file

# Draw.py

A tiny Windows drawing library for Python, built with `ctypes` and the native Win32 GDI API.

Draw.py provides a simple API for creating windows, drawing shapes, handling keyboard input, and reading mouse coordinates.

## Features

- Create native Windows windows
- Draw rectangles, circles, ellipses, lines, polygons, and pixels
- Display text
- Read keyboard and mouse input
- Control the update rate
- No Pygame or external graphics engine required

## Requirements

- Windows
- Python 3.9+
- `keyboard` Python package

## Installation

Install from PyPI:

```bash
pip install draw-win32
```

Or install the dependency separately when running from source:

```bash
python -m pip install keyboard
```

## Quick Start

```python
import draw

draw.create_window("My First Window", 640, 480)

while draw.is_open():
    draw.clear((30, 30, 30))

    draw.rectangle(100, 100, 150, 80, (0, 255, 0))
    draw.circle(350, 150, 40, (255, 0, 0))
    draw.line(50, 300, 500, 300, (255, 255, 255), 3)

    draw.text(100, 330, "Hello, Draw.py!", (255, 255, 0), 24)

    draw.update(60)
```

Close the window using its close button.

## Drawing API

### Window

- `create_window(title, width, height, bg)` — create the window.
- `is_open()` — check whether the window is open.
- `update(fps=60)` — process events, present the frame, and limit the update rate.
- `clear(color)` — clear the drawing buffer.

### Shapes

- `rectangle(x, y, w, h, color)`
- `ellipse(x, y, w, h, color)`
- `circle(cx, cy, radius, color)`
- `line(x1, y1, x2, y2, color, width=1)`
- `polygon(points, color)`
- `pixel(x, y, color)`
- `text(x, y, string, color=(0, 0, 0), size=20)`

Colors use RGB tuples, for example `(255, 0, 0)` for red.

### Input

- `mouse_pos()` — return the mouse position relative to the window.
- `mouse_down()` — check whether the left mouse button is held.
- `pressed(key)` — check whether a key is pressed.
- `press(key)` — simulate a key press.
- `release(key)` — simulate a key release.
- `key_read()` — read a keyboard event.
- `call_key(key, callback)` — register a key-press callback.
- `key_down(vk)` — check a Windows virtual-key code.
- `wait(seconds)` — pause execution.

## Platform

Draw.py is designed for Windows. It uses native Win32 APIs through `ctypes` and requires the `keyboard` dependency for its keyboard helpers.

## License

MIT License. See [LICENSE](LICENSE).
