Skip to content

init

malibx.init() -> Mlx

MiniLibX: mlx_init

Creates the connection handle that the rest of malibx works through.

Returns

An Mlx object. It holds your windows and your loop hook, and you pass it as the first argument to most other functions.

Notes

  • Call it once at the start of your program. Each Mlx is independent: its loop only runs its own windows, so a second one is rarely useful.
  • Unlike mlx_init, it never fails. Nothing talks to the windowing system until you call new_window, so display errors show up there.
  • An Mlx and its windows belong to the thread that created them, so use them only from that thread. Run malibx on your program's main thread: macOS requires windows to live there.

Example

import malibx

mlx = malibx.init()
win = malibx.new_window(mlx, 640, 480, "hello")
malibx.loop(mlx)

See also

new_window ยท loop