Skip to main content

Widgets for use with Pygame

Project description

Pygame Widgets

A helper module for common widgets that may be required in developing applications with Pygame. It supports fully customisable buttons, collections of buttons, textboxes, sliders and many more! If there are any widgets that you would like to see added, please create an issue!

Changes in Pygame Widgets v1.0.0

In v1.0.0, there are some minor changes to the use of the module, which may affect existing projects. This outlines the changes that will affect current users in the new version.

  • As more widgets are added, importing is now different
# Now
from pygame_widgets.button import Button

# Instead of
from pygame_widgets import Button  # Will not work
  • All widgets are now updated (draw and listen) by the update method
import pygame
import pygame_widgets
from pygame_widgets.button import Button

pygame.init()
win = pygame.display.set_mode((600, 600))
button = Button(win, 100, 100, 300, 150)

run = True
while run:
    events = pygame.event.get()
    for event in events:
        if event.type == pygame.QUIT:
            pygame.quit()
            run = False
            quit()
            
    win.fill((255, 255, 255))
    
    # Now
    pygame_widgets.update(events)
    
    # Instead of
    button.listen(events)
    button.draw()
    
    pygame.display.update()

Prerequisites

Installation

Ensure that Python 3 and pip are installed and added to your environment PATH.

python -m pip install pygame-widgets

Open a Python console and run the following command.

import pygame_widgets

If you receive no errors, the installation was successful.

If you do not already have Pygame or Pygame-CE installed, you will need to do so using one of the following commands.

python -m pip install pygame

python -m pip install pygame-ce

Usage

For full documentation, see pygamewidgets.readthedocs.io.

How to Contribute

Any contribution to this project would be greatly appreciated. This can include:

  • Finding errors or bugs and creating a new issue
  • Addressing active issues
  • Adding functionality
  • Improving documentation

If applicable, you should make any changes in a forked repository and then create a pull request once the changes are complete and preferably tested if possible.

Note: If writing any code, please attempt to follow the Code Style Guide

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pygame_widgets-1.3.1.tar.gz (24.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pygame_widgets-1.3.1-py3-none-any.whl (30.9 kB view details)

Uploaded Python 3

File details

Details for the file pygame_widgets-1.3.1.tar.gz.

File metadata

  • Download URL: pygame_widgets-1.3.1.tar.gz
  • Upload date:
  • Size: 24.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.5

File hashes

Hashes for pygame_widgets-1.3.1.tar.gz
Algorithm Hash digest
SHA256 38b7d42916bad5cec0a44df712e3e5c0f44443a085b507ff8ed899b6505442af
MD5 ccb45627a01468832169d56459765314
BLAKE2b-256 4ce165ca643714f19a3e73c561335b7db2af9ce324d163c261b7060f89a6176e

See more details on using hashes here.

File details

Details for the file pygame_widgets-1.3.1-py3-none-any.whl.

File metadata

  • Download URL: pygame_widgets-1.3.1-py3-none-any.whl
  • Upload date:
  • Size: 30.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.5

File hashes

Hashes for pygame_widgets-1.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2bc845922e921be662f59e413695c52740d3e2b8c6f86b2ee5507dd87c43ff5f
MD5 0e5553d221d099c3074a6c037b9acfbc
BLAKE2b-256 c609032d1d3c7faf686593e7bdaba87bfc94d2fae5a0e16f2e69b0a9f95d28fc

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