Create GUIs for pygame.
Project description
EasyPygameWidgets
An easy-to-use UI widget library for pygame, featuring customizable buttons, sliders, text entries, and screen management.
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 screen (optional)
screen = epw.Screen(id="main")
# create a button
button = epw.Button(screen=screen, text="Click Me!", width=200, height=50)
button.place(300, 250)
# create a slider
slider = epw.Slider(screen=screen, text="Volume", start=0, end=100, width=300)
slider.place(250, 350)
# create a text entry
entry = epw.Entry(screen=screen, text="Type here...", width=250)
entry.place(275, 450)
# main game loop
running = True
while running:
window.fill((30, 30, 30))
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()
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.
Slider
A slider for selecting values within a specific range.
Entry
A text entry with selection and clipboard support.
Label
A text display that can be used to drag it into places.
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.)
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()
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
- settings screen - interactive settings panel with sliders
- login form - form with entries and validation
- 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
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 Distribution
Built Distribution
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 easypygamewidgets-2.0.2.tar.gz.
File metadata
- Download URL: easypygamewidgets-2.0.2.tar.gz
- Upload date:
- Size: 19.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bf049b2c28d468cbbca752c59450befa9513e69792b2372d5dea25f0b06926ec
|
|
| MD5 |
eae72ea05c5b31a3d8c8756df6dd7185
|
|
| BLAKE2b-256 |
044912f007dba5b96484da57a26c73d3111b4827bd42e2868b2db70cdb248305
|
File details
Details for the file easypygamewidgets-2.0.2-py3-none-any.whl.
File metadata
- Download URL: easypygamewidgets-2.0.2-py3-none-any.whl
- Upload date:
- Size: 23.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
28f3bb07b3bd6c249b2fbf461dffe19029b521268bf2c2fe50384214ff853ac5
|
|
| MD5 |
8fb9c834ef36efa838c07aa8892fb724
|
|
| BLAKE2b-256 |
ba0d70c36e5358c8fc4838a4e204db67c1e9c60a6cacea4e22211fda66254343
|