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

Uploaded CPython 3.14tWindows x86-64

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

Uploaded CPython 3.14Windows x86-64

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

Uploaded CPython 3.13Windows x86-64

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

Uploaded CPython 3.12Windows x86-64

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

File metadata

  • Download URL: nevu_ui-0.7.0-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.0-cp314-cp314t-win_amd64.whl
Algorithm Hash digest
SHA256 755aabcd2476029caa47cf9c9d14bef04df011ec82bfa179ae57eaed3368f0b4
MD5 b5d41ce096b06c80bdfe8f7b099b1dc4
BLAKE2b-256 22b6e701bdf84375ab2cc7ea8f222739412e1882b36e6802789e01d962b82910

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nevu_ui-0.7.0-cp314-cp314t-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 61b9035e4390266eb85158a4c74c040e4ee9d515189610e9cd49e5dfd2d48df3
MD5 a109d0c4b86c9f21eb336cdd41bd05b8
BLAKE2b-256 9aebe13ff364992e0376975045c9c14d55bd39fe1e4b71425c13f983b8256b9a

See more details on using hashes here.

File details

Details for the file nevu_ui-0.7.0-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-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 763112f9296d6ca325dccf95db8adc30733bb71b63a72d268a25aa05fc3e0070
MD5 a50fd52d0a96fac1b69117f61acd10d7
BLAKE2b-256 029ee6d0c18c5b54d8ad6c078bd746c50383f438e1bf066936cf02a5b4fc1db7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: nevu_ui-0.7.0-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.0-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 7d8fc70649503b2e5b8b9ce2356fcf30bfd8daaa5b5a2d7faa2ae9f858df8831
MD5 72e11eff87500111f9226cdbc0192f07
BLAKE2b-256 3969aa306cc3c876ed455137ab6efeea946c4172201a12198aacbb7fd5c17cc5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nevu_ui-0.7.0-cp314-cp314-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 101ace7b8c6eff6cc56b5c3a29006501bc9776e058de46384504d72d8ce9cf8d
MD5 71cf5f3f9ca3403d12d14679a72ad5d6
BLAKE2b-256 974e05040e3b3c1d7e82b791cdc49255abc0947c304767bbca4ce047e7eb2e1a

See more details on using hashes here.

File details

Details for the file nevu_ui-0.7.0-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-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 fe4f9ade8326fb820a923828addfdb97baf7d8fd1811455ba66acbdc89a67001
MD5 9d71965c947653c745ec7c57f49c34a0
BLAKE2b-256 704a99a226f56eacbe0fb66bebcc6e32a479e1adb1ea29fa1e56256644e481bd

See more details on using hashes here.

File details

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

File metadata

  • Download URL: nevu_ui-0.7.0-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.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 2acaf85583dcd8d4bcd1bcad15078c0ce457d5b8be570fafc74d59fa15866f41
MD5 72dd756a60259ee13346d5088d00a6be
BLAKE2b-256 e183711a4c1cc14a8df22e77214d22d488bad4e0ad9193d164be81d7d5de4de4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nevu_ui-0.7.0-cp313-cp313-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 28f2beffe96f2f2ad4f49c74c86fcdc63f6de4d9162acfa94abf991eabfbac58
MD5 91df5095e8381b1ee42dad3ecf78ab53
BLAKE2b-256 ee66d4bda62465d7e33de4cacacff09beaf5cb4ad75f451375ec9087f663ed79

See more details on using hashes here.

File details

Details for the file nevu_ui-0.7.0-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-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 128778292185fa6b4eeff911b36e6c7e6f0a77f8527c120161589ed8187074b0
MD5 525fec927f67f5e6f11be8e6e57fdc01
BLAKE2b-256 1fef180449c81f6647cac74feef06a8e83c4074c5a1e5caadd021c45bbdea140

See more details on using hashes here.

File details

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

File metadata

  • Download URL: nevu_ui-0.7.0-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.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 245f6e718d3f239021b92276ec6a16c90cf8cf58b240518d5eeb6ac1ecf38c7f
MD5 f10156be99eb5a0a9b23c28ef727dfbb
BLAKE2b-256 fe4a11638aa57c9884d9e4669fd38f88ba483905bedea8fdf201ba03922d2edb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nevu_ui-0.7.0-cp312-cp312-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 e764931c4ddad406266fb1af056cc85638107343054b5af83237ce1e12b59762
MD5 a74e50228376730f3d378dcea10c4e03
BLAKE2b-256 31b59e6a5345a428b7e4a8813cb6374deebd060b5bcf7dd704c179bb77c53b77

See more details on using hashes here.

File details

Details for the file nevu_ui-0.7.0-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-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 d26d1b05083b30b9221736a781dfb9d29571a0ce57e7fa5a96e176e043d107c6
MD5 97e622ab5e7fb1bda02b7ba9df8f0cd7
BLAKE2b-256 737b68e772a86d1c8341281ffeb115a1474386bc87313b49cd72f122371cbb6d

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