Skip to main content

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.

example code

Button

A customizable button widget to run commands when interacted.

example code

Checkbox

A button that can toggle between pressed and unpressed. It displays the current state and can trigger commands based on them.

example code

Dialog

A popup with a title, description and interaction options (widgets) at the bottom.

example code

Entry

A text entry with selection and clipboard support.

example code

Label

A text display that can be used to drag it into places or show text.

example code

Slider

A slider for selecting values within a specific range.

example code

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.)

example code

Timekeeper

A text display that can show a timer or stopwatch.

example code

Tooltip

A text display that is only shown when you hover over a widgets.

example code

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:

  1. 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


Made with ❤️ by PizzaPost

Metadata

Release files for easypygamewidgets 26.45

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for easypygamewidgets 26.45
File Size Uploaded
easypygamewidgets-26.45.tar.gz 770.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for easypygamewidgets 26.45
File Interpreter ABI Platform
easypygamewidgets-26.45-py3-none-any.whl Python 3 none any Details

Total release size: 1.6 MB

Release files / easypygamewidgets-26.45.tar.gz

Download URL easypygamewidgets-26.45.tar.gz
Size 770.5 kB
Tags Source
SHA-256 checksum
How to use checksums
333956c003b2f7a75b2b8291ede440c162f6395fa124d5b020873aa7ff60c288
BLAKE2b-256 checksum
How to use checksums
256782b3281cd9acc80814561acf0c295560047cca02049be5f80712e373207a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release files / easypygamewidgets-26.45-py3-none-any.whl

Download URL easypygamewidgets-26.45-py3-none-any.whl
Size 786.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e34c43bf2d8f3124ac3530f5a1f4d4ca66a3957c326c221f4be7aae89db54cbb
BLAKE2b-256 checksum
How to use checksums
10ef57fd33a25a37785624420d7b5ecbd2eac0319184c150f986b6730c3785b6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release history Release notifications | RSS feed

This release

26.45 This release

2 release files

26.44

2 release files

26.43

2 release files

26.42

2 release files

26.41

2 release files

26.40

2 release files

26.39

2 release files

26.38

2 release files

26.37

2 release files

26.36

2 release files

26.35

2 release files

26.34

2 release files

26.33

2 release files

26.32

2 release files

26.31

2 release files

26.30

2 release files

26.29

2 release files

26.28

2 release files

26.27

2 release files

26.26

2 release files

26.25

2 release files

26.24

2 release files

26.23

2 release files

26.22

2 release files

26.21

2 release files

26.20

2 release files

26.19

2 release files

26.18

2 release files

26.17

2 release files

26.16

2 release files

26.15

2 release files

26.14

2 release files

26.13

2 release files

26.12

2 release files

26.11

2 release files

26.10

2 release files

26.9

2 release files

26.8

2 release files

26.7

2 release files

26.6

2 release files

26.5

2 release files

26.4

2 release files

26.3.1

2 release files

26.3

2 release files

26.2

2 release files

26.1

2 release files

26.0

2 release files

2.4.0

2 release files

2.3.1

2 release files

2.3.0

2 release files

2.2.1

2 release files

2.2.0

2 release files

2.1.2

2 release files

2.1.1

2 release files

2.1.0

2 release files

2.0.3

2 release files

2.0.2

2 release files

2.0.1

2 release files

2.0.0

2 release files

1.2.3

2 release files

1.2.2

2 release files

1.2.1

2 release files

1.2.0

2 release files

1.1.2

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.0

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page