str2d.Str2D.hide

Str2D.hide(char=' ')[source]

Hide where character array is char. This sets the alpha array to 0 where the character array is equal to char.

Parameters:

char (str, optional) – The character to hide, by default ‘ ‘.

Returns:

A new Str2D object with the data hidden.

Return type:

Str2D

Examples

Let’s create an instance of Str2D and assign it to the variable a and then hide the data.

from str2d import Str2D

a = Str2D('abcdef\nghijkl\nmnopqr\nstuvwx')
a
abcdef
ghijkl
mnopqr
stuvwx

The hiddent data doesn’t replace the character with a space but sets the alpha array to 0 where the character array is equal to the character to hide. So, in a singular context, we can still see the character and must fill the 0s with a character to hide the data.

a.hide(char='m').fill_with(char=' ')
abcdef
ghijkl
mno qr
stuvwx