Skip to content

Animations

code_video.HighlightLines

Highlights lines by reducing the opacity of all non-highlighted lines

__init__(self, code, start=1, end=-1, **kwargs) special

Parameters:

Name Type Description Default
code Code

The code instance to highlight

required
start int

The line number to start highlighting, inclusive

1
end int

The last line number to highlight

-1
Source code in code_video/code_walkthrough.py
def __init__(self, code: Code, start: int = 1, end: int = -1, **kwargs):
    """
    Args:
        code: The code instance to highlight
        start: The line number to start highlighting, inclusive
        end: The last line number to highlight
    """
    super().__init__(code, **kwargs)
    self.start_line_number = start
    self.end_line_number = end

code_video.HighlightLine

Highlights a single line by reducing the opacity of all non-highlighted lines

__init__(self, code, line_number, **kwargs) special

Parameters:

Name Type Description Default
code Code

The code instance to highlight

required
line_number int

The line number to highlight

required
Source code in code_video/code_walkthrough.py
def __init__(self, code: Code, line_number: int, **kwargs):
    """
    Args:
        code: The code instance to highlight
        line_number: The line number to highlight
    """
    super().__init__(code, start=line_number, end=line_number, **kwargs)

code_video.HighlightNone

Resets any previous highlighting by returning all source code lines to full opacity

__init__(self, code, **kwargs) special

Parameters:

Name Type Description Default
code Code

The code instance to reset

required
Source code in code_video/code_walkthrough.py
def __init__(self, code: Code, **kwargs):
    """
    Args:
        code: The code instance to reset
    """
    super().__init__(code, start=code.line_no_from, **kwargs)