str2d.Str2D.hole

Str2D.hole(radius, char='*')[source]

Create a hole over the object. This is a wrapper around the hole function and returns a new Str3D object with the hole over the data. This effectively hides the surrounding data and only shows the hole.

Parameters:
  • radius (float) – The radius of the hole. The minimum of the height and width of the data is used as a reference for the radius equal to 1.

  • char (str, optional) – The character to use for the hole, by default ‘*’.

Returns:

A new Str3D object with the hole over the data.

Return type:

Str3D

See also

circle

Create a circle over the data.

Examples

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

from str2d import Str2D

a = 3 * Str2D('abcdef\nghijkl\nmnopqr\nstuvwx') * 4
abcdefabcdefabcdefabcdef
ghijklghijklghijklghijkl
mnopqrmnopqrmnopqrmnopqr
stuvwxstuvwxstuvwxstuvwx
abcdefabcdefabcdefabcdef
ghijklghijklghijklghijkl
mnopqrmnopqrmnopqrmnopqr
stuvwxstuvwxstuvwxstuvwx
abcdefabcdefabcdefabcdef
ghijklghijklghijklghijkl
mnopqrmnopqrmnopqrmnopqr
stuvwxstuvwxstuvwxstuvwx
a.hole(1, char=' ')
       bcdefabcde
    klghijklghijklgh
  opqrmnopqrmnopqrmnop
 tuvwxstuvwxstuvwxstuvw
abcdefabcdefabcdefabcdef
ghijklghijklghijklghijkl
mnopqrmnopqrmnopqrmnopqr
stuvwxstuvwxstuvwxstuvwx
 bcdefabcdefabcdefabcde
  ijklghijklghijklghij
    qrmnopqrmnopqrmn
       tuvwxstuvw