
malibx¶
A tiny window and pixel library for Python, written in Rust, with a MiniLibX-style API. Runs on macOS, Linux and Windows.
import malibx
mlx = malibx.init()
win = malibx.new_window(mlx, 640, 480, "hello")
malibx.string_put(mlx, win, 20, 30, 0xB040FF, "hello, pixels")
malibx.loop(mlx)
That's a whole program: a window, some text, and an event loop that runs until you close it.
-
Install in one line
Prebuilt wheels for every major platform. No compiler and no X server setup.
-
Your first window
Open a window, draw on it, and close it cleanly, step by step.
-
The main loop
How frames, hooks and events fit together. Read this before you build anything that moves.
-
Drawing
Pixels, colors, text, and fast off-screen images.
-
Keyboard and mouse
Respond to keys, clicks and the close button.
-
Coming from MiniLibX?
Same function names, without the
mlx_prefix.mlx_pixel_put(mlx, win, x, y, c)becomesmalibx.pixel_put(mlx, win, x, y, c).
Why malibx?¶
- Small. The 30 functions of MiniLibX, no more. You can learn the whole API in an afternoon.
- Direct. You get a window and a buffer of pixels. There's no scene graph, sprite engine or framework to learn first.
- Familiar. It follows MiniLibX, the graphics library used by 42 schools, so code and ideas from C projects like so_long, fract-ol, FdF and cub3D carry straight over.
- Portable. The same script runs on macOS, Linux and Windows.