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.6.7-cp314-cp314t-win_amd64.whl (833.8 kB view details)

Uploaded CPython 3.14tWindows x86-64

nevu_ui-0.6.7-cp314-cp314t-musllinux_1_2_x86_64.whl (2.2 MB view details)

Uploaded CPython 3.14tmusllinux: musl 1.2+ x86-64

nevu_ui-0.6.7-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (2.2 MB view details)

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

nevu_ui-0.6.7-cp314-cp314-win_amd64.whl (798.8 kB view details)

Uploaded CPython 3.14Windows x86-64

nevu_ui-0.6.7-cp314-cp314-musllinux_1_2_x86_64.whl (2.1 MB view details)

Uploaded CPython 3.14musllinux: musl 1.2+ x86-64

nevu_ui-0.6.7-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (2.1 MB view details)

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

nevu_ui-0.6.7-cp313-cp313-win_amd64.whl (786.9 kB view details)

Uploaded CPython 3.13Windows x86-64

nevu_ui-0.6.7-cp313-cp313-musllinux_1_2_x86_64.whl (2.1 MB view details)

Uploaded CPython 3.13musllinux: musl 1.2+ x86-64

nevu_ui-0.6.7-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (2.1 MB view details)

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

nevu_ui-0.6.7-cp312-cp312-win_amd64.whl (789.0 kB view details)

Uploaded CPython 3.12Windows x86-64

nevu_ui-0.6.7-cp312-cp312-musllinux_1_2_x86_64.whl (2.1 MB view details)

Uploaded CPython 3.12musllinux: musl 1.2+ x86-64

nevu_ui-0.6.7-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (2.1 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.6.7-cp314-cp314t-win_amd64.whl.

File metadata

  • Download URL: nevu_ui-0.6.7-cp314-cp314t-win_amd64.whl
  • Upload date:
  • Size: 833.8 kB
  • Tags: CPython 3.14t, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for nevu_ui-0.6.7-cp314-cp314t-win_amd64.whl
Algorithm Hash digest
SHA256 75e49accced1d9c912d5e00e7c4b10606973e8f22b87a45fa8d3e010fd1eb232
MD5 0ef11f1c89ad3a401e3f0759eb5b46da
BLAKE2b-256 9a41c5077b3a4fa928df7a74d176a757a6b3c53acf0bb2bef51cc5ddd26284fa

See more details on using hashes here.

File details

Details for the file nevu_ui-0.6.7-cp314-cp314t-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for nevu_ui-0.6.7-cp314-cp314t-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 02aa500152af64350eb7c51dc96038e296779ca7852c309c952686f768504fe9
MD5 ca871c3281b841f538505c98e8954cc7
BLAKE2b-256 d591a0f2d0da62d3efd60fe720e71869ca156740f0bc3c3b0ab8710bfd952f17

See more details on using hashes here.

File details

Details for the file nevu_ui-0.6.7-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.6.7-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 dcfbdec2794188921256300e8ba8b361d56183c270558e99611cdf1c87c28da2
MD5 3054d6263cd1b52aeed7074570e6a54c
BLAKE2b-256 6ad2ff4f8b1989609610ab3fbec021aef28209b2d3afd827126531c7d8b1fc66

See more details on using hashes here.

File details

Details for the file nevu_ui-0.6.7-cp314-cp314-win_amd64.whl.

File metadata

  • Download URL: nevu_ui-0.6.7-cp314-cp314-win_amd64.whl
  • Upload date:
  • Size: 798.8 kB
  • Tags: CPython 3.14, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for nevu_ui-0.6.7-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 f818ff5d934c5aa643337b6fbd9c3e12a843c93eb3ebf6f4959b49dc0c8f1c85
MD5 2ecec1587dea39f967a430a24e1c6e42
BLAKE2b-256 0f2c569e1fd4405d598da30802652f0bcc176ae3f4b1ddccdf187f585aebb0f8

See more details on using hashes here.

File details

Details for the file nevu_ui-0.6.7-cp314-cp314-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for nevu_ui-0.6.7-cp314-cp314-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 d2169ee6834f8710d9566c0d1604c5a572985b8ea490e4a4a06f814644008a2b
MD5 91bc2971075f6933304fa02cb6868453
BLAKE2b-256 2f1eca57175aec9ca79b873947b6481023162535a559d46782eddc2a18dfff2a

See more details on using hashes here.

File details

Details for the file nevu_ui-0.6.7-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.6.7-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 606b0f653b933499189a93a4f0250c7a2e8aeb94f416e8e1ac5f978a0823f6c7
MD5 bcac7ee9ba202b4149fbfd9de96191ee
BLAKE2b-256 c2a38874a76ad50ff5eecd45bb4357b0f06684d575652ca88e6ef889f0aabfad

See more details on using hashes here.

File details

Details for the file nevu_ui-0.6.7-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: nevu_ui-0.6.7-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 786.9 kB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for nevu_ui-0.6.7-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 ae8d3f8d9a3529a03b63cf94c5614027772b5f4612458411f0aa1257278bd4d3
MD5 c928bd455806c8629966ea497f8591c2
BLAKE2b-256 63902b0dca3509a2fcc779312d5f4a0356fc1be455e1ebb9d19a9e2559844c8e

See more details on using hashes here.

File details

Details for the file nevu_ui-0.6.7-cp313-cp313-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for nevu_ui-0.6.7-cp313-cp313-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 4dfd0ec773d743ddbee817f70aab843ade22e1372a9fb002ec0e635b4c97ebf8
MD5 cb222e69651172e3c9fb4d24c3b3909f
BLAKE2b-256 f0a4cd26d6f885e5af3c0116d69b464cd8da5c36b4ad3e5201a0d5de322ad098

See more details on using hashes here.

File details

Details for the file nevu_ui-0.6.7-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.6.7-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 38af1763ae0698c7326f856e3fee5c747b1a8542ae586f27c6e1d2e95c7e9c2e
MD5 413cdd0ee4ae217ba16d8bf4a46de404
BLAKE2b-256 fd625001f989981aa6e68b007916e99b6578e38cbf4884df927448eeedbd6ea4

See more details on using hashes here.

File details

Details for the file nevu_ui-0.6.7-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: nevu_ui-0.6.7-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 789.0 kB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for nevu_ui-0.6.7-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 583c538be6a349ffb4ddf5ae3d13c80442cb7199706a20833799a9b59ce2a745
MD5 548f8db629eb0cd394ab5efdcb02ab58
BLAKE2b-256 5582b1f8dda3fe7832c4feafa0481bc2572b82175aa025eded7322efb612485f

See more details on using hashes here.

File details

Details for the file nevu_ui-0.6.7-cp312-cp312-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for nevu_ui-0.6.7-cp312-cp312-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 23dec032dc1ab1b67408c877e21e03da5d1fcb6b43bc6d3de2094d922299feca
MD5 409c14ac354cb062badbd44ac98d1a40
BLAKE2b-256 10e1b01eb1768300e1ce830d4148652f86b76318cf381e151403bc168b0fd74f

See more details on using hashes here.

File details

Details for the file nevu_ui-0.6.7-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.6.7-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 2a0375459e1bf7f8dffa32e60c22580ba56c7fb4d67cfe6810f3333aae307454
MD5 e9acd6542f541d2bf9a8d338f3a4ed36
BLAKE2b-256 7f9f43958af6cf842819cfd77183672129bbf9652d97340357087efc39ac9cac

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