Skip to content

malibx

malibx

A tiny window and pixel library for Python, written in Rust, with a MiniLibX-style API. Runs on macOS, Linux and Windows.

Get started GitHub

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.

    Installation

  • Your first window


    Open a window, draw on it, and close it cleanly, step by step.

    Your first window

  • The main loop


    How frames, hooks and events fit together. Read this before you build anything that moves.

    The main loop

  • Drawing


    Pixels, colors, text, and fast off-screen images.

    Drawing

  • Keyboard and mouse


    Respond to keys, clicks and the close button.

    Keyboard and mouse

  • Coming from MiniLibX?


    Same function names, without the mlx_ prefix. mlx_pixel_put(mlx, win, x, y, c) becomes malibx.pixel_put(mlx, win, x, y, c).

    Start here

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.