A powerful GUI framework for Pygame that allows you to create menus
Project description
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
Styleobject.- 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.
- Themes: Ready-made color themes in
- 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(...))
- There are 2 types of animations:
Constant System (Constant Engine):
ConstantEngineis 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 classTypedDict - The variable will not be visible IN ALL hints if you do not specify the name and type at the beginning of the class
- Declaratively add variables to the object's
- 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.0Cythonnumpy
- For Running:
pygame-ce>=2.3.0numpyPillowmoderngl
Installation via pip
pip install nevu-ui
Examples
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
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
- Gmail: bebrovgolem@gmail.com
- Creator: Nikita A.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file nevu_ui-0.7.0.post1-cp314-cp314t-win_amd64.whl.
File metadata
- Download URL: nevu_ui-0.7.0.post1-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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
82667be7f990ab97362e58610423f557319d32ebd5d3171a1e597d0e94f9f0af
|
|
| MD5 |
581b89334001f7ac6a1a518e3a45d1d8
|
|
| BLAKE2b-256 |
483c710bbe024f4a624e1e6a6ff16f0df0e23b27926769a0648d5ee4da217495
|
File details
Details for the file nevu_ui-0.7.0.post1-cp314-cp314t-musllinux_1_2_x86_64.whl.
File metadata
- Download URL: nevu_ui-0.7.0.post1-cp314-cp314t-musllinux_1_2_x86_64.whl
- Upload date:
- Size: 3.3 MB
- Tags: CPython 3.14t, musllinux: musl 1.2+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1edfa1f2b6fd8e41d30d78b3461291233a2f30d4f86091aa567f2a812e12129b
|
|
| MD5 |
2dab6beef0c1a6357036971b116b1eac
|
|
| BLAKE2b-256 |
d53d527d9a00ba840f53891f8f0f6f0d4b25777b4050f85fb123a0ae557e4ba2
|
File details
Details for the file nevu_ui-0.7.0.post1-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.
File metadata
- Download URL: nevu_ui-0.7.0.post1-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
- Upload date:
- Size: 3.4 MB
- Tags: CPython 3.14t, manylinux: glibc 2.17+ x86-64, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fe62007dc05d4584457517b35376e5580c934e1596b3b53e2b81d00cd3786e8d
|
|
| MD5 |
426bb976f293d3a3e7c5c190f7628e8b
|
|
| BLAKE2b-256 |
0a711e150640cc053a12dd333c80b3e4eb5dbca9025faea0bc077c7f511769d9
|
File details
Details for the file nevu_ui-0.7.0.post1-cp314-cp314-win_amd64.whl.
File metadata
- Download URL: nevu_ui-0.7.0.post1-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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
515e69266a5986de0df1d2173725a675e93b3d46d0178d34fe2374bc436ce8c2
|
|
| MD5 |
d982fee2d8f3b0699b4509b9b37c283c
|
|
| BLAKE2b-256 |
5687fc721b744414302ecde5b9240491ab343db9de83ca4e4e7e5b8245882895
|
File details
Details for the file nevu_ui-0.7.0.post1-cp314-cp314-musllinux_1_2_x86_64.whl.
File metadata
- Download URL: nevu_ui-0.7.0.post1-cp314-cp314-musllinux_1_2_x86_64.whl
- Upload date:
- Size: 3.2 MB
- Tags: CPython 3.14, musllinux: musl 1.2+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5ac39b4071d5a781ef30eaeab7994a145b3d130ef4f2158fcaa9f07e7d77882b
|
|
| MD5 |
0ec80be4aed6a8ab6bdc2732489ebaf4
|
|
| BLAKE2b-256 |
aa6299097c6a80597394633c1edfdfc57c3d17282270498e7a95d1705b1718d0
|
File details
Details for the file nevu_ui-0.7.0.post1-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.
File metadata
- Download URL: nevu_ui-0.7.0.post1-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
- Upload date:
- Size: 3.2 MB
- Tags: CPython 3.14, manylinux: glibc 2.17+ x86-64, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0ff767c16dc7207e0b0b1e4b0c86cfd5943748c2cd165c384f9a8e3e33b2ebec
|
|
| MD5 |
994d614347907e984e9573adf35d4429
|
|
| BLAKE2b-256 |
a0ee4d0dfcd5fd34cc5b00a3318a10bd93e906e4908f5403f4661712814338c5
|
File details
Details for the file nevu_ui-0.7.0.post1-cp313-cp313-win_amd64.whl.
File metadata
- Download URL: nevu_ui-0.7.0.post1-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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
38978d539e0bb2773f9e779ec5fcd4018b50e031b47fe041fb54c6b07579b91f
|
|
| MD5 |
0c817e484b2e6ee793745a2abb0e2112
|
|
| BLAKE2b-256 |
d0171744bee05e075e4fe5130448d4a9b9ee3b16c6a0b61593eeaa744c777e6a
|
File details
Details for the file nevu_ui-0.7.0.post1-cp313-cp313-musllinux_1_2_x86_64.whl.
File metadata
- Download URL: nevu_ui-0.7.0.post1-cp313-cp313-musllinux_1_2_x86_64.whl
- Upload date:
- Size: 3.2 MB
- Tags: CPython 3.13, musllinux: musl 1.2+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
384550dbe403e0b2b656f5637f87ad7eedd395c2b3310513c5d3901e401490f2
|
|
| MD5 |
875562bce96c08f8b9ef6e474ed084b0
|
|
| BLAKE2b-256 |
c1ef23ea8bb212af01b136f5a2c3dd683d08fd7a88fa7fe7cb82210d7d58c5c3
|
File details
Details for the file nevu_ui-0.7.0.post1-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.
File metadata
- Download URL: nevu_ui-0.7.0.post1-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
- Upload date:
- Size: 3.2 MB
- Tags: CPython 3.13, manylinux: glibc 2.17+ x86-64, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8924411bdca3e38561dc238ada3b59cc2d14277d7b6ff3fb5399272383e03a0f
|
|
| MD5 |
1ab4f2152c0210c1a1a04fbefa8affda
|
|
| BLAKE2b-256 |
ace59923c06691fa1543fc9a11654fbe6dc1afd0b138e716c08d8d5c44586579
|
File details
Details for the file nevu_ui-0.7.0.post1-cp312-cp312-win_amd64.whl.
File metadata
- Download URL: nevu_ui-0.7.0.post1-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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
73cd865039131e38b2eade1527e02f408ad4ec98b1b694eedf0a1c330345b87f
|
|
| MD5 |
67f265a13c05a72f8df7f9115bff6d88
|
|
| BLAKE2b-256 |
565dabc65e567a5a4fc23824fb04cd4754ccb6ce9464b02b88e9f15961dfb70e
|
File details
Details for the file nevu_ui-0.7.0.post1-cp312-cp312-musllinux_1_2_x86_64.whl.
File metadata
- Download URL: nevu_ui-0.7.0.post1-cp312-cp312-musllinux_1_2_x86_64.whl
- Upload date:
- Size: 3.2 MB
- Tags: CPython 3.12, musllinux: musl 1.2+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
213594d641ecfa5597db26e06a86465c162fdf0aa9cf4bed6ff120ea21c8f309
|
|
| MD5 |
a63e38eb16b0911a31894317a6b6ba1a
|
|
| BLAKE2b-256 |
1c14c02cea49d3d5a281333bae119b0870702945240816b5c20b39c85284d57e
|
File details
Details for the file nevu_ui-0.7.0.post1-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.
File metadata
- Download URL: nevu_ui-0.7.0.post1-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
- Upload date:
- Size: 3.2 MB
- Tags: CPython 3.12, manylinux: glibc 2.17+ x86-64, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
089f6a9f035b130e864923cb57e65bd1defcbe57228830b31554411d6ceac281
|
|
| MD5 |
6b9c5beb4368a51a7564a66a3e70a100
|
|
| BLAKE2b-256 |
636ae6622b5cc6348ee59d2e501b8c16abe003a2e647f0883a4a99205ad05b6a
|