semvec/pypi-packages huggingface dataset:
pg-vtscreen 0.1.0
A virtual screen manager for Pygame that handles window scaling and fullscreen functionality
Requires Python: >=3.6

# pg_vtscreen

A virtual screen manager for Pygame that handles window scaling, aspect ratio maintenance, and fullscreen functionality.

## Features

- Create a virtual screen (game logic drawing area) independent of the display window
- Manage the actual display window with enhanced functionality
- Support fullscreen toggle (default F11 key)
- Maintain aspect ratio when resizing windows
- Handle basic window events (close, resize)

## Installation
pip install pg_vtscreen
## Usage Example
import pygame
from pg_vtscreen import VirtualScreenManager

# Initialize Pygame
pygame.init()

# Create virtual screen manager
vsm = VirtualScreenManager()

# Create virtual screen (game resolution)
virtual_screen = vsm.create_virtual_window(1280, 720)

# Create display window (user's window)
display_screen = vsm.create_display_window(
    size=(800, 600),
    flags=pygame.RESIZABLE,
    caption="pg_vtscreen Example"
)

# Main loop
clock = pygame.time.Clock()
running = True

while running:
    # Handle events
    vsm.handle_events()
    
    # Draw on virtual screen
    virtual_screen.fill((0, 0, 0))  # Black background
    pygame.draw.circle(virtual_screen, (0, 255, 0), (640, 360), 50)  # Green circle in center
    
    # Project virtual screen to display
    vsm.project_to_screen(maintain_aspect_ratio=True)
    
    # Maintain 60 FPS
    clock.tick(60)
## Documentation

### VirtualScreenManager Class

#### Methods

- `__init__()`: Initialize the virtual screen manager
- `create_virtual_window(width, height)`: Create a virtual drawing surface
- `create_display_window(size=(), flags=0, ...)`: Create the actual display window
- `set_fullscreen_key(key)`: Set custom key for fullscreen toggle (default F11)
- `project_to_screen(maintain_aspect_ratio=True)`: Scale and draw virtual screen to display
- `handle_events()`: Handle basic window events (close, resize, fullscreen)

## License

This project is licensed under the BSD License - see the LICENSE file for details.
runtime.serialization 0.0.0a0
Provides serialization to and from json, hjson, yaml and toml files.
Requires Python: >=3.10
Keywords: windows, linux, serialization

[![Test](https://github.com/apmadsen/runtime-serialization/actions/workflows/python-test.yml/badge.svg)](https://github.com/apmadsen/runtime-serialization/actions/workflows/python-test.yml)
[![Coverage](https://github.com/apmadsen/runtime-serialization/actions/workflows/python-test-coverage.yml/badge.svg)](https://github.com/apmadsen/runtime-serialization/actions/workflows/python-test-coverage.yml)
[![Stable Version](https://img.shields.io/pypi/v/runtime-serialization?label=stable&sort=semver&color=blue)](https://github.com/apmadsen/runtime-serialization/releases)
![Pre-release Version](https://img.shields.io/github/v/release/apmadsen/runtime-serialization?label=pre-release&include_prereleases&sort=semver&color=blue)
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/runtime-serialization)
[![PyPI Downloads](https://static.pepy.tech/badge/runtime-serialization/week)](https://pepy.tech/projects/runtime-serialization)

# runtime-serialization

Provides serialization to and from json, hjson, yaml and toml files.

## Example

```python
from runtime.serialization.json import Serializer, serialize, deserialize
from runtime.serialization import serializable
from datetime import date

@serializable(namespace="tests.examples")
class Author:
    def __init__(self, name: str, birthday: date):
        self.__name = name
        self.__birthday = birthday

    @property
    def name(self) -> str:
        return self.__name

    @property
    def birthday(self) -> date:
        return self.__birthday

@serializable(namespace="tests.examples")
class Book:
    def __init__(self, title: str, author: Author):
        self.__title = title
        self.__author = author

    @property
    def title(self) -> str:
        return self.__title

    @property
    def author(self) -> Author:
        return self.__author

author = Author("Stephen King", date(1947, 9, 21))
book = Book("The Shining", author)
serializer = Serializer[Book]()
serialized = serializer.serialize(book) # -> {"author": {"birthday": "1947-09-21", "name": "Stephen King"}, "title": "The Shining"}
deserialized = serializer.deserialize(serialized)
assert deserialized.author.name == author.name
assert deserialized.title == book.title

# same result, different approach without the need for instantiating Serializer manually
serialized = serialize(book, Book)

# and without a base type, the type info is embedded
serialized_untyped = serialize(book) # -> {"author": {"birthday": "1947-09-21", "name": "Stephen King"}, "title": "The Shining", "~type": "tests.examples.Book"}
deserialized_untyped = deserialize(serialized_untyped)
assert deserialized_untyped.author.name == deserialized.author.name
assert deserialized_untyped.title == deserialized.title
```
## Full documentation

[Go to documentation](https://github.com/apmadsen/runtime-serialization/blob/main/docs/documentation.md)