Skip to content

Integration

How to integrate Nevu UI into your existing project

You can easily integrate Nevu UI into your project, to do so you need to use InitializedWindow After Window created you can use all features of Nevu UI

Pygame

import pygame

import nevu_ui as ui

pygame.init()

display = pygame.display.set_mode((800, 600))
window = ui.InitializedWindow.from_pygame(display)

#... rest of your code

Raylib

import nevu_ui as ui
import pyray
#... your code

pyray.init_window(800, 600, "Hello:)")

window = ui.InitializedWindow.from_raylib()

#... rest of your code

Pygame Events integration

Nevu UI by default collects events automatically but, if you have event dependent code or dont want to use Nevu UI abstractions(Like mouse or keyboard), you can pass events directly into Window.update method:

import pygame

import nevu_ui as ui

pygame.init()

window = ui.Window((800, 600), backend=ui.Backend.Pygame)

while True:
    window.begin_frame()
    events = pygame.event.get()
    window.update(events=events)
    window.end_frame()