Skip to main content

a simple python library used to draw text-based 2d grid game map and informations

Project description

About Rotom

rotom is a simple tui library used to draw tilemap and some informations on terminal.

Fast Usage

import rotom
tilemap = rotom.Tilemap(5, 5)
tilemap.set_char(0, 0, '@')
print(tilemap)

and you will get something like below:

@ · · · · 
· · · · · 
· · · · · 
· · · · · 
· · · · · 

you can set color, background color, bold and underline to style the char like this:

tilemap = Tilemap(10, 10)
tilemap.set_char(0, 0, '@', color="#942c4b", bold=True, underline=True)
print(tilemap)

you will get something like this (the result in markdown file should be the same because this only work in terminal):

@ · · · ·
· · · · ·
· · · · ·
· · · · ·
· · · · ·

and you can add a border for it

tilemap = Tilemap(5, 5)
print(add_border(tilemap()))

you will get something like this:

+-----------+
| · · · · · |
| · · · · · |
| · · · · · |
| · · · · · |
| · · · · · |
+-----------+

except the game map, rotom provide tool to render informations.

tilemap = Tilemap(8, 8)
tilemap.set_char(5, 5, '@')

infos = InfoBoard()
infos.set_info("title", "content")

result = horizontal_combine(tilemap(), infos(), sep='   ')
print(result)

this would output:

· · · · · · · ·   +--------------------------------+
· · · · · · · ·   | title: content                 |
· · · · · · · ·   +--------------------------------+
· · · · · · · ·   
· · · · · · · ·   
· · · · · @ · ·   
· · · · · · · ·   
· · · · · · · ·   

I use horizontal_combine to combine two string, but also can be combined as vertical.

result = vertical_combine(tilemap(), infos(), sep='/')
print(result)
· · · · · · · ·
· · · · · · · ·
· · · · · · · ·
· · · · · · · ·
· · · · · · · ·
· · · · · @ · ·
· · · · · · · ·
· · · · · · · ·
//////////////////////////////////
+--------------------------------+
| title: content                 |
+--------------------------------+

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

rotem-0.1.0.tar.gz (6.6 kB view details)

Uploaded Source

Built Distribution

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

rotem-0.1.0-py3-none-any.whl (6.9 kB view details)

Uploaded Python 3

File details

Details for the file rotem-0.1.0.tar.gz.

File metadata

  • Download URL: rotem-0.1.0.tar.gz
  • Upload date:
  • Size: 6.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.6

File hashes

Hashes for rotem-0.1.0.tar.gz
Algorithm Hash digest
SHA256 6570a02cc9f7afff0f17afe3ab0f4579332b4144bbe3b8dfcf47aaa4dac7fad2
MD5 75508aba3b65dbf126af54e8cfca1327
BLAKE2b-256 63c41491c38adf35249bb4eef29c6effd790b17f8ab1aa7863f78b058e2bf786

See more details on using hashes here.

File details

Details for the file rotem-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: rotem-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.6

File hashes

Hashes for rotem-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 885b2b88b8961ceab81718ff81c9b545ecda8de87dfea3224de23610ec7bde6f
MD5 9ca8c3c3f077053c45bfc865694ab70f
BLAKE2b-256 c414aef7890e27e8f759a7c50c40af7065ad27c0bd01a42884d1b9f287395d8a

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