Skip to content

Line bouncing effect text printer module for Python

License

Notifications You must be signed in to change notification settings

urbanware-org/bouncefx

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

BounceFX

Table of contents


Definition

The BounceFX module allows printing a string with a bouncing effect from left to right.

You can find more text printing effects here.

Top

Details

The given string is printed on the left of the current line, moving to the right side column by column until the string reaches the end of the line. The length of the line can either be a given value (e.g. 80 characters) or automatically determined (depending on the terminal size). Then, the string bounces and moves left column by column again.

Usage

First of all, the module must be imported.

import bouncefx

Method

Notice that the delay must be given in milliseconds.

The method requires four arguments:

  • string
    • The string that should be bounced in the line.
  • line_length
    • The length in characters that should be used for bouncing. Setting this to 0 will automatically determine the length (columns) of the terminal line.
  • delay
    • The delay between moving the string left or right.
  • bounces
    • The number of bounces that should be done. Setting this to 0 results in unlimited bounces.
bouncefx.bounce_line(string, line_length=80, delay=0.1, bounces=3)

Example

The following code

import bouncefx
bouncefx.bounce_line("This is an example.", line_length=38, delay=0.1, bounces=0)

produces this output:

BounceFX sample output

Top

Requirements

In order to use BounceFX, the Python 3.x framework (version 3.2 or higher is recommended) must be installed on the system.

There is no official version for Python 2.x, but if you need that for whatever reason, you can try refactoring the syntax from Python 3.x to version 2.x using the 3to2 tool.

However, there is no guarantee that this works properly or at all.

Top

Contact

Any suggestions, questions, bugs to report or feedback to give?

You can contact me by sending an email to dev@urbanware.org or by opening a GitHub issue (which I would prefer if you have a GitHub account).

Top

Useless facts

  • The project name is an abbreviation for Bounce Effects.

Top