EasyPygameWidgets
An easy-to-use UI widget library for pygame, featuring customizable buttons, sliders, text entries, screen management and much more.
Features
- easy integration: seamlessly works with existing pygame projects
- customizable widgets: nearly infinite styling options for colors, sounds, cursors, and more
- screen management: built-in screen system for creating different GUIs
Installation
Windows
pip install easypygamewidgets
Linux/macOS
python3 -m pip install easypygamewidgets
Quick Start
import pygame
import easypygamewidgets as epw
pygame.init()
window = pygame.display.set_mode((800, 600))
clock = pygame.time.Clock()
# link the pygame window
epw.link_pygame_window(window)
# create a button
button = epw.Button(text="Click Me!")
button.place(300, 100)
# create a slider
slider = epw.Slider(text="Volume", start=0, end=100, auto_size=False, width=300)
slider.place(300, 200)
# create a text entry
entry = epw.Entry(placeholder_text="Type here...", auto_size=False, width=250)
entry.place(300, 400)
def draw():
window.fill((30, 30, 30))
# main game loop
running = True
while running:
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
# handle widget events
epw.handle_event(event)
# handle special widget events
epw.handle_special_events()
# draw all widgets
epw.flip(draw)
pygame.display.update()
clock.tick(60)
pygame.quit()
Widgets Documentation
All examples will use the same start template code.
Screen
A container for managing groups of widgets with shared visibility and state.
Button
A customizable button widget to run commands when interacted.
Checkbox
A button that can toggle between pressed and unpressed. It displays the current state and can trigger commands based on them.
Dialog
A popup with a title, description and interaction options (widgets) at the bottom.
Entry
A text entry with selection and clipboard support.
Label
A text display that can be used to drag it into places or show text.
Slider
A slider for selecting values within a specific range.
Surface (images etc.)
This converts your pygame surfaces into an easypygamewidgets widget that can be used in screens. (All pygame surface commands can be applied to the "surface" attribute of your widget.)
Timekeeper
A text display that can show a timer or stopwatch.
Tooltip
A text display that is only shown when you hover over a widgets.
Module Functions
Core Functions
# link your pygame window (required before using widgets)
epw.link_pygame_window(pygame_window)
# handle pygame events (call in event loop)
epw.handle_event(pygame_event)
# handle special events (call outside event loop)
epw.handle_special_events()
# draw all widgets to the linked window
epw.flip()
Other Functions
# disable the update check when linking the pygame window (could improve startup time)
epw.disable_update_check()
# run a function every frame but draw the content on a specific layer
epw.create_pygame_layer(function, layer)
# set the appearance mode (light (0), dark (1), system (2))
epw.set_appearance_mode(mode)
# schedule something callable
epw.schedule(function, time_to_execute, unit, fps)
# turn a folder, video, image, pygame surface into a list of pygame surfaces that can be used for an animated Surface widget
epw.create_frames(path)
Examples (COMING SOON)
Check the examples directory for complete working examples:
- all widgets example - simple demo of all widgets
screens with animations - multiple screens with transitions 3. settings screen - interactive settings panel with sliders 4. login form - form with entries and validation 5. bindings - binding events to widgets
Requirements
- python
- pygame
- requests (for update checking in background once)
I recommend using the latest version of libraries.
Contributing
Contributions are welcome! Please feel free to submit a pull request. Of course will be mentioned :)
License
This project is licensed under the MIT License - see the LICENSE file for details.
Support
-
Issues: GitHub Issues
-
Discord: My Account
-
Instagram: My Account
-
License: MIT
-
History: GitHub History
Made with ❤️ by PizzaPost
Metadata
Release files for easypygamewidgets 26.42
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| easypygamewidgets-26.42.tar.gz | 749.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| easypygamewidgets-26.42-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 1.5 MB
Release files / easypygamewidgets-26.42.tar.gz
| Download URL | easypygamewidgets-26.42.tar.gz |
|---|---|
| Size | 749.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1c9db0393e575b22957e49491d97db1e1b4f612fe4524e353bffbb6c6ba6b27b
|
|
BLAKE2b-256 checksum How to use checksums |
9d669cfe5a43c3d29d12529566589022050cbdb4c30466a00f14d9c8c515d310
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.6
|
Release files / easypygamewidgets-26.42-py3-none-any.whl
| Download URL | easypygamewidgets-26.42-py3-none-any.whl |
|---|---|
| Size | 770.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6d7b53bbc8160acee4699ed562be14145189d999ccbfcf2b7170496d31aac23b
|
|
BLAKE2b-256 checksum How to use checksums |
d73f40972268d926f6212aa92a662d8ebc709fc658192a2dae75b417d8801b58
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.6
|