Skip to main content

A UI extention onto pygame. Quite simple actually.

Project description

pygameshort

A user interface extension library for Pygame with built-in networking capabilities.

Features

  • Enhanced UI Components

    • Button system with hover and click effects
    • Input boxes with full text editing capabilities
    • Smooth animations and transitions
    • Customizable color schemes and themes
  • Advanced Text Handling

    • Multi-line text support
    • Text selection and manipulation
    • Copy/paste functionality
    • Undo/redo system
  • Integrated Networking

    • Seamless integration with secure_network library
    • Easy-to-use connection management
    • Event-based network communication
    • Built-in security features
  • Flexible Layout System

    • Box-based positioning
    • Size and position matrices
    • Automatic text wrapping
    • Responsive design capabilities

Installation

pip install pygameshort

Dependencies

  • pygame
  • secure_network
  • pyperclip

Roadmap

  • ✔️ Uses secure networking package by me
  • ✔️ Window, plus managers
    • ✔️ Event manager / distrebutor (Tickets)
  • ✔️ All events are gathered into one event flow
  • ✔️ Cooldown class
  • ✔️ Cursor system
  • ✔️ Systems for metrical values
  • ✔️ Systems for fonts and color values
  • ✔️ Object system(s)
    • ✔️ Fully functional text (input) system
    • ✔️ Easily made custom objects
    • ✔️ Buttons
    • ✔️ Input Box
    • ❌ Sliders
    • ❌ Loading bars
    • ❌ Movable, resizeable, closable ..etc.. windows
    • ❌ Drag and drop
    • ❌ Tab system
    • ❌ Layout manager
    • More to be added!

Quick Start

import pygameplus as pgp

# Create a window with networking
key = pgp.Key(b'I\xebi\xc3U\xa47\x85I%I@9\xf9b\ry\x807Fq\x1aj\x15585\xf8P\xc45\xb7H\xccg\x0fs\x92s\xd70\xd2o\x9fw\x83J/lt-\x03R\xb1Q^H\xf1O\xadQ 0\xe1') # Leave empty to generate a new
fernet_key, hmac_key = key.extract()
conn = pgp.Connection(fernet_key, hmac_key, "localhost", 8000, pgp.secure_network.CLIENT)

# Initialize window
window = pgp.Window("My App", conn, on_render=lambda: None)

# Create a button
button = pgp.Button(
    text="Click Me!",
    box=pgp.Box(100, 100, 200, 50),
    color=pgp.ColorData.create_light_theme(),
    font=pgp.FontSet().load_system_font("Arial", (12, 16, 24)),
    border_radius=5,
    border_width=2,
    switch=False,
    callback=lambda: print("Button clicked!")
)

# Create an input box
input_box = pgp.InputBox(
    text="Enter text...",
    box=pgp.Box(100, 200, 200, 50),
    color=pgp.ColorData.create_light_theme(),
    font=pgp.FontSet().load_system_font("Arial", (12, 16, 24)),
    border_radius=5,
    border_width=2
)

# Create a scene
scene = pgp.Scene([button, input_box])

# Set up render function
def render():
    window.screen.fill((255, 255, 255))
    scene.draw()

window.on_render.append(render)

# Start the application
# Use "window.connect()" whenever you want to connect using the connection
# Remember to set the address correctly first
# Also remember to then auth with a username and a correlating password
window.run()

UI Components

Button

The Button class provides a customizable button with:

  • Hover effects
  • Click animations
  • Toggle functionality
  • Smooth size transitions

InputBox

The InputBox class offers a full-featured text input with:

  • Text selection
  • Copy/paste support
  • Cursor management
  • Multi-line support
  • Word wrapping

Window

The Window class serves as the main container and provides:

  • Event management
  • Scene rendering
  • Network integration
  • Frame rate control

Networking

The library integrates with the secure_network package for encrypted communication:

# Create a secure connection
key = pgp.Key()
fernet_key, hmac_key = key.extract()
conn = pgp.Connection(
    fernet_key,
    hmac_key,
    "localhost",
    8000,
    pgp.secure_network.CLIENT
)

# Send data
conn.send("Hello, server!")

Themes

pygameshort includes built-in theme support:

# Light theme
light_theme = pgp.ColorData.create_light_theme()

# Dark theme
dark_theme = pgp.ColorData.create_dark_theme()

Contributing

-- To be added --

Contributions are welcome! Please feel free to submit a Pull Request.

License

[Add your chosen license here]

Author

Neo Zetterberg

Acknowledgments

Built on top of the excellent Pygame library | Uses secure_network for encrypted communication

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

pygameshort-1.0.2.tar.gz (15.5 kB view details)

Uploaded Source

Built Distribution

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

pygameshort-1.0.2-py3-none-any.whl (13.6 kB view details)

Uploaded Python 3

File details

Details for the file pygameshort-1.0.2.tar.gz.

File metadata

  • Download URL: pygameshort-1.0.2.tar.gz
  • Upload date:
  • Size: 15.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.1

File hashes

Hashes for pygameshort-1.0.2.tar.gz
Algorithm Hash digest
SHA256 87954845d2e8feef048bdde2e53988f779a1809ba60f42e5cca045f4a386bbf0
MD5 012235a0201975334cdc5e6042216c22
BLAKE2b-256 499a95bf5d99a75d7b2d14e97fb19d7817ff7e24c94a59978ed08f1accb15b4c

See more details on using hashes here.

File details

Details for the file pygameshort-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: pygameshort-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 13.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.1

File hashes

Hashes for pygameshort-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c38d5e649ea5d1b435bf5ac799c7faaf23f45cd55d360eafb477cc5308f63fa8
MD5 5fbf4ee227f1e4522dbf0657e23bd4a7
BLAKE2b-256 ff441395217d93bc94c2c2cab52ecb37da36374dea813a4d4041d472f2c5a973

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