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.1-cp314-cp314t-win_amd64.whl (1.3 MB view details)

Uploaded CPython 3.14tWindows x86-64

nevu_ui-0.7.1-cp314-cp314t-musllinux_1_2_x86_64.whl (3.4 MB view details)

Uploaded CPython 3.14tmusllinux: musl 1.2+ x86-64

nevu_ui-0.7.1-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.1-cp314-cp314-win_amd64.whl (1.2 MB view details)

Uploaded CPython 3.14Windows x86-64

nevu_ui-0.7.1-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.1-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.1-cp313-cp313-win_amd64.whl (1.2 MB view details)

Uploaded CPython 3.13Windows x86-64

nevu_ui-0.7.1-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.1-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.1-cp312-cp312-win_amd64.whl (1.2 MB view details)

Uploaded CPython 3.12Windows x86-64

nevu_ui-0.7.1-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.1-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.1-cp314-cp314t-win_amd64.whl.

File metadata

  • Download URL: nevu_ui-0.7.1-cp314-cp314t-win_amd64.whl
  • Upload date:
  • Size: 1.3 MB
  • 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.7.1-cp314-cp314t-win_amd64.whl
Algorithm Hash digest
SHA256 ae8ad7dad2cd189cfb48011bd80413d10985bdd97f263a631b4e2732c9171b79
MD5 9b370c1637664b660d2eaa86e7393e39
BLAKE2b-256 13d03fad19217f36a1f892d96fa0d78c12baa1ec2c0dc08e00a0551183012d1f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nevu_ui-0.7.1-cp314-cp314t-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 71785b7d625683d464099e1300eb55b43615af38df689f3d7026d2df9ce4eb4b
MD5 d36a4f14c0286f7dd10f0fd2f28f3d24
BLAKE2b-256 71324d791e83ad363636a8423b08c5dfc9ade6007c4963a8d6c9818c4befdc3d

See more details on using hashes here.

File details

Details for the file nevu_ui-0.7.1-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.1-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 b8a544f962df30ac9752590c5defebf15223d16e0af50f30b467a4e09c2bcd17
MD5 12b238f75dcff115faafc84bcf7a282b
BLAKE2b-256 460ad10f86b44ae8b91d8b10593d24753f9862f59a3b1d8c73d5adb3d7799d4f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: nevu_ui-0.7.1-cp314-cp314-win_amd64.whl
  • Upload date:
  • Size: 1.2 MB
  • 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.7.1-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 aaad6c475dae617583b1b5ef5a92faef8cca4adf9f1e0332df7a2541c8e15cad
MD5 109a8710b0529f2091591e8e487b80df
BLAKE2b-256 b43bbefdaa7530c03952fdb145431cbd5c3a914fc92eb8574dd53b0df3630a33

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nevu_ui-0.7.1-cp314-cp314-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 583967b5ab48195990b1f3c90371731d30a291db18cd413239c8c2b6795f3d7f
MD5 628a8068b47a162907dfa88bdcc01721
BLAKE2b-256 631dec42fdd7668b3be4d325fbb9303f33d5ad0bf1b1fd810f1d31d0e993aace

See more details on using hashes here.

File details

Details for the file nevu_ui-0.7.1-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.1-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 e5ae4f8d05ac3629b66dfb6708cbfe7dc09fb80f5f20ce4ac8cd229f53bc92ca
MD5 607ac1c03d0289d24637aac1d8e46d3d
BLAKE2b-256 47fb616b0613be3c9f1a41c961f84ee3c30ee58184bf40c51f5b894445c207b4

See more details on using hashes here.

File details

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

File metadata

  • Download URL: nevu_ui-0.7.1-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 1.2 MB
  • 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.7.1-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 300ebf9ade21e96b9b7d6f12cc9b446b3baf9183859120cc5c3ebf87db8701f1
MD5 22f393267fdc80fbe1b1f2010a343847
BLAKE2b-256 5335384e421e56f6d4a7ef9426bff4fa44cee9c712bc55c0b800af0ec674fcb4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nevu_ui-0.7.1-cp313-cp313-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 ff9b2fdf1ef083e9925d85a6edbe0e71dec586e1a4b9091fdf4bee035d63c62d
MD5 c8225b6ae0b6cfa328348827d3b3e330
BLAKE2b-256 835db2f1dfde6929d0def21c59feae4dfa031174fc574aab825c6caa15062e78

See more details on using hashes here.

File details

Details for the file nevu_ui-0.7.1-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.1-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 f28108e0ff954fecf6d9f10ca22ac1b925db65149e8af4324f077ef4202327b5
MD5 744ba2aea71d3a3c7a4d9d6667189f8c
BLAKE2b-256 ee129b12899641da09471adfd7606f5ae8b1ec334b9f25ef022b2f8879f27ff2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: nevu_ui-0.7.1-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 1.2 MB
  • 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.7.1-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 fdc432bf2613e8e99d05dcff5e66acb4e284c1a22a577a40d0f652cf65433f6c
MD5 faef3fa52d833682f28334e85f91c92f
BLAKE2b-256 1dcd5312753695b9f8be18fe85d8960f1bd84905f5805bff4338437199e7091d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nevu_ui-0.7.1-cp312-cp312-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 4385d0611362492b1ad8cdd2e21a5771bd7d756a7cc5826f651ba0c6c1c98c32
MD5 61fe7594a278968224044991c891fbe6
BLAKE2b-256 e8f3050386a93de4ed6aad4e8e766f1be20a2ddedba25009195230dbfc73217f

See more details on using hashes here.

File details

Details for the file nevu_ui-0.7.1-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.1-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 43b1c9b4acccd4c5b993ad0969cc8a01db0f8b76d6a47e1500dc614dfb9b8afe
MD5 1a9995b4c088424d15499fa6e9554b44
BLAKE2b-256 88525de0379c124a44e1c44cf80a0bfc46e4393643d38ea127632c6d72a148ec

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