Skip to content

Python library that permits to recycle microbits exercices in terminal python using 5 * 5 strings and some coloring.

License

Notifications You must be signed in to change notification settings

MixTeen/pycrobit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pycrobit

Coverage Status PyPI version Code style: black PRs Welcome

Python library that permits to recycle microbits exercises in python using 5 * 5 strings and some coloring without the hassle of handling terminal coloring and refresh.

Context

We have a lot of fun exercises for children using microbits but a lot less using python.

Installation

pip install pycrobit[colorama]

Or download pycrobit.py for offline use.

Example of use

from pycrobit import Fore, Pycrobit

all_lit = """
*****
*****
*****
*****
*****
"""
all_off = """
.....
.....
.....
.....
....."""


pycrobit = Pycrobit(framerate=0.50)
while True:
    pycrobit.display(all_lit)  # Lit red by default
    pycrobit.display(all_off)
    pycrobit.display(all_lit, {"*": Fore.YELLOW})
    pycrobit.display(all_off)
    pycrobit.display(all_lit, {"*": Fore.GREEN})
    pycrobit.display(all_off)
    pycrobit.display("*.*.*\n" * 5)
    pycrobit.wait(-0.25)  # Previous display will be shown 0.5 - 0.25s = 0.25s
    pycrobit.display(".***." * 5)
    pycrobit.wait(0.25)  # Previous display will be shown 0.5 + 0.25s = 0.75s

About

Python library that permits to recycle microbits exercices in terminal python using 5 * 5 strings and some coloring.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages