TUI_pygame
A simple Text-Based User Interface (TUI) game framework for creating terminal-based games. This module allows you to create a text-based game with mouse control, character placement, and screen updates.
Features
- Initialize screen dimensions based on user input.
- Control a mouse cursor using 'w', 's', 'a', 'd' keys.
- Place characters at specific coordinates on the screen.
- Refresh the screen to reflect changes.
- Exit the game loop gracefully.
Installation
To install TUI_pygame, you can use pip:
pip install TUI_pygame
Usage
Basic Example
Here's a basic example of how to use the TUI-game module:
import TUI_pygame
import time
# Initialize the game screen
TUI_pygame.initialize()
# Main game loop
while True:
if not TUI_pygame.run():
break
TUI_pygame.update_screen()
time.sleep(0.001) # Add a brief delay to prevent the program from running too fast
Customizing the Game Loop
You can also customize the game loop by adding your own logic:
import TUI_pygame
import time
# Initialize the game screen
TUI_pygame.initialize()
# Custom game loop
while True:
# Place a character at a specific position
TUI_pygame.place_character('X', (5, 5))
# Move the mouse cursor
TUI_pygame.move_mouse('w')
# Process user input
if not TUI_pygame.run():
break
# Update the screen
TUI_pygame.update_screen()
# Add a brief delay
time.sleep(0.001)
Functions
initialize()
Initializes the screen dimensions and content. This function must be called before entering the game loop.
run()
Processes user input and returns True to continue the game loop or False to exit.
update_screen()
Refreshes the screen to reflect changes.
place_character(character, position)
Places a character at the specified coordinates on the screen.
move_mouse(direction)
Moves the mouse cursor in the specified direction ('w', 's', 'a', 'd').
Contributing
Contributions are welcome! If you have any suggestions or improvements, please feel free to open an issue or submit a pull request.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Metadata
Release files for TUI-pygame 0.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| tui_pygame-0.1.4.tar.gz | 3.6 kB | Without provenance | Details for tui_pygame-0.1.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| tui_pygame-0.1.4-py3-none-any.whl | Python 3 | none | any | Details for tui_pygame-0.1.4-py3-none-any.whl |
Total release size: 7.4 kB
Release files / tui_pygame-0.1.4.tar.gz
| Download URL | tui_pygame-0.1.4.tar.gz |
|---|---|
| Size | 3.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e8832a4ddd7a27590f9cfc98ffa39faac7bce879ac565486f3697ffd08230089
|
|
BLAKE2b-256 checksum How to use checksums |
897ea46d669c591ec999c111aea72c86340432b32d601d76d90a047ac7ec55fa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.11
|
Release files / tui_pygame-0.1.4-py3-none-any.whl
| Download URL | tui_pygame-0.1.4-py3-none-any.whl |
|---|---|
| Size | 3.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
43dd9540e477eb8a094cb158a81309929b52dd27417a4ae1421130595b21436a
|
|
BLAKE2b-256 checksum How to use checksums |
5cb1327b2f6b306ed186fe5be8e00edce17fc05c648065163d5cc31325b0c9a4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.11
|
Security for TUI-pygame 0.1.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.