Imperative
Building first app with imperative way
First thing first, import nevu-ui and create a window.
To create a Window you must specify size other arguments are not required, Window initializes screen with specified backend(default is pygame):
import nevu_ui as ui
import pygame
pygame.init()
window = ui.Window((800, 600), title="Nevu UI App")
Menu, you'll need to put window and size as it's arguments:
menu = ui.Menu(window, (800, 600))
Menu and Window are created, you need to create any layout, for example i picked Grid:
grid = ui.Grid((800, 600), row=3, column=3)
Grid layout done, you can add something inside it via add_item:
grid.add_item(ui.Label("Nevu UI", (400, 200)), 2, 2)
menu.layout = grid
while True:
window.begin_frame()
window.update()
menu.update()
menu.draw()
window.end_frame()
Full code:
import nevu_ui as ui
import pygame
pygame.init()
window = ui.Window((800, 600), title="Nevu UI App")
menu = ui.Menu(window, (800, 600))
grid = ui.Grid((800, 600), row=3, column=3)
grid.add_item(ui.Label("Nevu UI", (400, 200)), 2, 2)
menu.layout = grid
while True:
window.begin_frame()
window.update()
menu.update()
menu.draw()
window.end_frame()