Skip to main content

A powerful GUI framework for Pygame that allows you to create menus

Project description

Example1

alt text

Brief Description

Nevu UI is a library for the declarative creation of user interfaces in Pygame. The project aims to provide developers with a set of ready-made, stylable, and extensible components for the rapid creation of modern and responsive interfaces in games and multimedia applications.

The main goal of Nevu UI: to make creating interfaces in python even easier and faster

Key features include:

  • Layout system: Convenient arrangement of elements, for example, using grids (Grid) and scrollable containers (ScrollableColumn).
  • Set of widgets: Ready-to-use elements such as buttons, input fields, and labels.
  • Flexible styling: The ability to customize the appearance through a style system that supports colors, gradients, and borders.
  • Animations: Built-in support for animations to create dynamic and lively interfaces.
  • Declarativeness: Support for declarative interface creation

Style

Style - storage of parameters for customizing the appearance

Editable parameters:

  • Gradient
  • ColorTheme - Analogous to MaterialDesign, there is a ready-made set of themes - ColorThemeLibrary
  • Font name/size
  • Border Width/Radius
  • Text Align X/Y
  • Transparency

Main Features

Nevu UI allows you to describe an interface with a clear structure

Examples of declarativeness:

  • Declarative approach: Describe your interface just as you see it.
    # Specify content directly when creating the layout
    grid = ui.Grid(content={(1,1): ui.Button(...)})
    
  • Adaptive size system (SizeRules): Forget about pixels. Use relative values that adjust to the size of the window or parent element.
    • vh / vw: Percentage of the window's height/width.
    • fillx / filly / fill: Percentage of the parent layout's height/width/size.
    • gc / gcw / gch: Percentage of the grid cell size.
    • Prefix c: can be placed in any SizeRule, it means that the current value will be taken (without the prefix, the original will be taken).
  • Powerful style system: Customize every aspect of the appearance using the universal Style object.
    • Themes: Ready-made color themes in ColorThemeLibrary.
    • Gradients: Support for linear and radial.
    • Inheritance: Styles can be created based on existing ones.
    • And much more: Fonts, borders, rounding, transparency.
  • Built-in animations: Bring your interface to life with ready-made animations for movement, transparency, etc.
    • There are 2 types of animations:
      • Start - Allows you to set the initial appearance of the widget.
      • Infinite - Produces an infinite animation defined in animation_manager.
    • Usage example:
      • widget.animation_manager.add_start_animation(ui.animations.EaseOut(...))

Constant System (Constant Engine):

  • ConstantEngine is a convenient tool built into all layouts and widgets, it allows you to:
    • Declaratively add variables to the object's __init__
    • Check the variable type during initialization and after
    • The variable will not be visible in hints for __init__ if it was not added to the class TypedDict
    • The variable will not be visible IN ALL hints if you do not specify the name and type at the beginning of the class
  • Examples:
    import nevu_ui as ui
    from typing import Unpack, NotRequired
    
    #Create a TypedDict with variables (optional)
    class MyWidgetKwargs(ui.WidgetKwargs):
        my_var: NotRequired[int | float]
    
    class MyWidget(ui.Widget):
        #Create a typehint for the variable (optional but recommended)
        my_var: int | float
        def __init__(self, size: NvVector2 | list, style: Style = default_style, **constant_kwargs: Unpack[MyWidgetKwargs]):
            super().__init__(size, style, **constant_kwargs)
    
        #Override the function to add constants (mandatory)
        def _add_constants(self):
            super()._add_constants()
    
          #Add a constant (mandatory)
            self._add_constant('my_var', int | float)
    
            #You can also add a link to a constant
            #self._add_constant_link('my_var', 'my_var_new_name')
    
            #You can also block a constant if necessary
            #self._block_constant('my_var')
    

Installation

Dependencies:

Python >= 3.12.*

  • For Building:
    • setuptools >= 61.0
    • Cython
    • numpy
  • For Running:
    • pygame-ce>=2.3.0
    • numpy
    • Pillow
    • moderngl

Installation via pip

pip install nevu-ui

Examples

Example1

Example2

Example3


Basic Grid

Declarative Approach

import nevu_ui as ui #Import Nevu UI
import pygame

pygame.init()

class MyGame(ui.Manager): #Create the base of our application
    def __init__(self):
        window = ui.Window((400, 300), title = "My Game") #Create a window
        super().__init__(window) #initialize the manager
        self.menu = ui.Menu(self.window, [100*ui.vw, 100*ui.vh], #Create a menu
                            layout= ui.Grid([100*ui.vw, 100*ui.vh], row=3, column=3, #Create a grid layout
                                            content = {
                                                (2, 2): ui.Button(lambda: print("You clicked!"), "Button", [50*ui.fill,33*ui.fill]) #Create a button
                                            }))
    def on_draw(self):
        self.menu.draw() #draw the menu
    def on_update(self, events):
        self.menu.update() #update the menu

game = MyGame()
game.run() #Run the finished application

Imperative Approach

import nevu_ui as ui #Import Nevu UI
import pygame

pygame.init()

window = ui.Window((400, 300), title = "My Game") #Create a window

menu = ui.Menu(window, [100*ui.vw, 100*ui.vh]) #Create a menu

layout = ui.Grid([100*ui.vw, 100*ui.vh], row=3, column=3) #Create a grid layout
layout.add_item(ui.Button(lambda: print("You clicked!"), "Button", [50*ui.fill,33*ui.fill]), x = 2, y = 2) #Create a button

menu.layout = layout #Set the menu layout

while True: #Main loop
    events = pygame.event.get() #Get events
    window.update(events) #Update the window
    menu.update() #Update the menu
    menu.draw() #Draw the menu
    pygame.display.update() #Update the screen

Example Result

Example1

Nevu UI Status at the Moment

Layouts (Layout_Type)

(✅ - done, ❌ - not done, 💾 - deprecated)

  • Grid
  • Row
  • Column
  • ScrollableRow
  • ScrollableColumn
  • 💾 IntPickerGrid
  • Pages
  • 💾 Gallery_Pages
  • StackColumn
  • StackRow
  • CheckBoxGroup

Widgets (Widget)

  • Widget
  • Button
  • Label
  • Input
  • EmptyWidget
  • Tooltip (In 0.6.X)
  • 💾 Image
  • 💾 Gif
  • MusicPlayer (Will be reworked)
  • ProgressBar
  • SliderBar
  • ElementSwitcher
  • 💾 FileDialog
  • RectCheckBox

License

Nevu UI is protected by the MIT license

Additional Information

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

nevu_ui-0.7.0.post2-cp314-cp314t-win_amd64.whl (1.3 MB view details)

Uploaded CPython 3.14tWindows x86-64

nevu_ui-0.7.0.post2-cp314-cp314t-musllinux_1_2_x86_64.whl (3.3 MB view details)

Uploaded CPython 3.14tmusllinux: musl 1.2+ x86-64

nevu_ui-0.7.0.post2-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (3.4 MB view details)

Uploaded CPython 3.14tmanylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

nevu_ui-0.7.0.post2-cp314-cp314-win_amd64.whl (1.2 MB view details)

Uploaded CPython 3.14Windows x86-64

nevu_ui-0.7.0.post2-cp314-cp314-musllinux_1_2_x86_64.whl (3.2 MB view details)

Uploaded CPython 3.14musllinux: musl 1.2+ x86-64

nevu_ui-0.7.0.post2-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (3.2 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

nevu_ui-0.7.0.post2-cp313-cp313-win_amd64.whl (1.2 MB view details)

Uploaded CPython 3.13Windows x86-64

nevu_ui-0.7.0.post2-cp313-cp313-musllinux_1_2_x86_64.whl (3.2 MB view details)

Uploaded CPython 3.13musllinux: musl 1.2+ x86-64

nevu_ui-0.7.0.post2-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (3.2 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

nevu_ui-0.7.0.post2-cp312-cp312-win_amd64.whl (1.2 MB view details)

Uploaded CPython 3.12Windows x86-64

nevu_ui-0.7.0.post2-cp312-cp312-musllinux_1_2_x86_64.whl (3.2 MB view details)

Uploaded CPython 3.12musllinux: musl 1.2+ x86-64

nevu_ui-0.7.0.post2-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (3.2 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

File details

Details for the file nevu_ui-0.7.0.post2-cp314-cp314t-win_amd64.whl.

File metadata

File hashes

Hashes for nevu_ui-0.7.0.post2-cp314-cp314t-win_amd64.whl
Algorithm Hash digest
SHA256 ba4ca0bd95cdb76031c25627603708ca75313fe98132d2fb6c398073373c2035
MD5 1f4cde6afdc8b996208ef1fb8b37a118
BLAKE2b-256 cb192c79988e232df34595fc733ea218e89566aaf5489faf50d30cb3f0f8a726

See more details on using hashes here.

File details

Details for the file nevu_ui-0.7.0.post2-cp314-cp314t-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for nevu_ui-0.7.0.post2-cp314-cp314t-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 7460c8d06772397afbac6b43fe19df7c262cc0501ba8db9a20124e3c36d694e9
MD5 fb8d762848a8ddf4a2ac3352ce088359
BLAKE2b-256 fcf817f1736038bce60437708f2ad2cd7eef45ec272721124f7541c5405707a3

See more details on using hashes here.

File details

Details for the file nevu_ui-0.7.0.post2-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for nevu_ui-0.7.0.post2-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 4d43a6ea4d70ed2c4804116fd12ab7cb34f54fe0187a97c0798b586f50084049
MD5 911435d4d05df80fdf404f9defaa0c44
BLAKE2b-256 1ddcef1a3eba5439258866484ef4cb61edddea88d978e3b7e5d1246971f8fc80

See more details on using hashes here.

File details

Details for the file nevu_ui-0.7.0.post2-cp314-cp314-win_amd64.whl.

File metadata

File hashes

Hashes for nevu_ui-0.7.0.post2-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 a874f5ed9df8bf1e95f4f81421db394ea5ff9bd4f3b147e24d9f597c3735cefa
MD5 0c1ab6cbfac11cff344d69221681453b
BLAKE2b-256 e729c4d2a34bf3aacec8dd44dd5c0b374f6e36d1d72a8edb8410840087e646c3

See more details on using hashes here.

File details

Details for the file nevu_ui-0.7.0.post2-cp314-cp314-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for nevu_ui-0.7.0.post2-cp314-cp314-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 db42b9a03101267cf9a4553f9b574ed1a283ed869690b0f9e2ee390be0d0e4fd
MD5 38f83e29b16db08f4a665fdf3ed52766
BLAKE2b-256 422f5baa1ba958e83c60c01ef87b3cad13b13a94ba5152922c6c1933ff57695e

See more details on using hashes here.

File details

Details for the file nevu_ui-0.7.0.post2-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for nevu_ui-0.7.0.post2-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 31471a945b767e705e508903ac15bb1f3f69e0ea5b7d82d5276bee44a261533e
MD5 72a7eae7a19f8ecb30c4161d1d6a4581
BLAKE2b-256 f9aeb7699127bccd14f01e765b386a102d0fb1e86efbeed3aeb7f62f8edcfb54

See more details on using hashes here.

File details

Details for the file nevu_ui-0.7.0.post2-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for nevu_ui-0.7.0.post2-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 9bd4893ea200837495beac30e1ab03741b936d8d5e229fac9931a9561e4222b4
MD5 827e9cf016134700f8c1ca69e5bbd823
BLAKE2b-256 ae189ae777d0ed92b7310092f43ef7e7b16c03397d21fcb5cc1bada61231702e

See more details on using hashes here.

File details

Details for the file nevu_ui-0.7.0.post2-cp313-cp313-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for nevu_ui-0.7.0.post2-cp313-cp313-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 b89ef9ab4eb161969dfce494da9a92d7cd64280d55751ed1410c4b0da7280cbe
MD5 3d14bb263b24746bc33a54d6352c2dbe
BLAKE2b-256 e581ff68e36080661f3fd6c320ee669d6cc64af07bf30eaf7c10d1dc5cc6c949

See more details on using hashes here.

File details

Details for the file nevu_ui-0.7.0.post2-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for nevu_ui-0.7.0.post2-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 0ba08685187aaa053b928482bb551bf8c45975b451dd5f357999a1f80131c8fd
MD5 a512c7550ecd55a5bbb79cf9bdd2b35f
BLAKE2b-256 767da016ba77be6daf59ac95ce51f3845c69ba91e8e5dc7bb72d588c443f1021

See more details on using hashes here.

File details

Details for the file nevu_ui-0.7.0.post2-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for nevu_ui-0.7.0.post2-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 392cefd3bd4273f284b07d1b57ee6800e396e584fabfdc1e57e73bc1d1b40de7
MD5 8f463d9ec17564646c113d48b0551bc2
BLAKE2b-256 e65fa3645f872d262e1f335dc35fca90c3ba587572c6c82ecabef0bbb26ddc80

See more details on using hashes here.

File details

Details for the file nevu_ui-0.7.0.post2-cp312-cp312-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for nevu_ui-0.7.0.post2-cp312-cp312-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 9982fa010116b21e2c7aea66910f5b628b5b46c632e76a441df3685daa72e245
MD5 cfb5bcd5256ded27fdabf3bb14929901
BLAKE2b-256 317c3928b7209f75bafd3af276c91126d2faa1492e2fc96d3a9ebd4b3a65cc88

See more details on using hashes here.

File details

Details for the file nevu_ui-0.7.0.post2-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for nevu_ui-0.7.0.post2-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 f1b7d9835862af5675551cd185799056569808ea52534ace013c5fd0d5049414
MD5 755d1ab8bbb9b11c12a3437ecd9bfb3e
BLAKE2b-256 ffa04683c1535f241dddcc3c1e8e8482cbb702b79baf9f373cb89eca40d449d7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page