How to use asciimatics - 10 common examples

To help you get started, we’ve selected a few asciimatics examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github cowboy8625 / WordRPG / gui / _backup / asciimatics / test_asciimatics_splash.py View on Github external
Print(screen, ImageFile( IMG_COWBOY, screen.height - 2,
								colours=screen.colours),
								0,
								stop_frame = 200 ),
		# Print(screen,
		# 		FigletText( COMPANY, font = 'digital' ),
		# 					screen.height // 2 - 3,
		# 					colour = 1,
		# 					bg = 2 if screen.unicode_aware else 0 )
		Print( screen, COMPANY )
	]
	scenes.append(Scene(effects))

	effects = [
		Print(screen,
				FigletText("W A S T E L A N D S",
								font='diamond' if screen.width > 80 else 'banner'),
				screen.height // 2 - 3,
				colour = 1, bg = 2 if screen.unicode_aware else 0 ),
	]
	scenes.append(Scene(effects))


	screen.play(scenes, stop_on_resize=True)
github cowboy8625 / WordRPG / gui / _backup / asciimatics / test_asciimatics_splash.py View on Github external
def demo(screen):

	scenes = [ ]

	effects = [
		Print(screen, ImageFile( IMG_COWBOY, screen.height - 2,
								colours=screen.colours),
								0,
								stop_frame = 200 ),
		# Print(screen,
		# 		FigletText( COMPANY, font = 'digital' ),
		# 					screen.height // 2 - 3,
		# 					colour = 1,
		# 					bg = 2 if screen.unicode_aware else 0 )
		Print( screen, COMPANY )
	]
	scenes.append(Scene(effects))

	effects = [
		Print(screen,
				FigletText("W A S T E L A N D S",
								font='diamond' if screen.width > 80 else 'banner'),
github cowboy8625 / WordRPG / gui / _backup / asciimatics / test_asciimatics_splash.py View on Github external
effects = [
		Print(screen, ImageFile( IMG_COWBOY, screen.height - 2,
								colours=screen.colours),
								0,
								stop_frame = 200 ),
		# Print(screen,
		# 		FigletText( COMPANY, font = 'digital' ),
		# 					screen.height // 2 - 3,
		# 					colour = 1,
		# 					bg = 2 if screen.unicode_aware else 0 )
		Print( screen, COMPANY )
	]
	scenes.append(Scene(effects))

	effects = [
		Print(screen,
				FigletText("W A S T E L A N D S",
								font='diamond' if screen.width > 80 else 'banner'),
				screen.height // 2 - 3,
				colour = 1, bg = 2 if screen.unicode_aware else 0 ),
	]
	scenes.append(Scene(effects))


	screen.play(scenes, stop_on_resize=True)
github peterbrittain / asciimatics / asciimatics / screen.py View on Github external
Screen.COLOUR_WHITE: (win32console.FOREGROUND_RED |
                                  win32console.FOREGROUND_GREEN |
                                  win32console.FOREGROUND_BLUE)
        }

        # Background colour lookup table.
        _BG_COLOURS = {
            Screen.COLOUR_BLACK: 0,
            Screen.COLOUR_RED: win32console.BACKGROUND_RED,
            Screen.COLOUR_GREEN: win32console.BACKGROUND_GREEN,
            Screen.COLOUR_YELLOW: (win32console.BACKGROUND_RED |
                                   win32console.BACKGROUND_GREEN),
            Screen.COLOUR_BLUE: win32console.BACKGROUND_BLUE,
            Screen.COLOUR_MAGENTA: (win32console.BACKGROUND_RED |
                                    win32console.BACKGROUND_BLUE),
            Screen.COLOUR_CYAN: (win32console.BACKGROUND_BLUE |
                                 win32console.BACKGROUND_GREEN),
            Screen.COLOUR_WHITE: (win32console.BACKGROUND_RED |
                                  win32console.BACKGROUND_GREEN |
                                  win32console.BACKGROUND_BLUE)
        }

        # Attribute lookup table
        _ATTRIBUTES = {
            0: lambda x: x,
            Screen.A_BOLD: lambda x: x | win32console.FOREGROUND_INTENSITY,
            Screen.A_NORMAL: lambda x: x,
            # Windows console uses a bitmap where background is the top nibble,
            # so we can reverse by swapping nibbles.
            Screen.A_REVERSE: lambda x: ((x & 15) * 16) + ((x & 240) // 16),
            Screen.A_UNDERLINE: lambda x: x
        }
github peterbrittain / asciimatics / samples / fireworks.py View on Github external
screen.height // 2 - 6,
                         speed=1,
                         start_frame=100))
    effects.append(Print(screen,
                         Rainbow(screen, FigletText("NEW YEAR!")),
                         screen.height // 2 + 1,
                         speed=1,
                         start_frame=100))
    scenes.append(Scene(effects, -1))

    screen.play(scenes, stop_on_resize=True)


while True:
    try:
        Screen.wrapper(demo)
        sys.exit(0)
    except ResizeScreenError:
        pass
github peterbrittain / asciimatics / samples / fire.py View on Github external
stop_frame=30),
        Print(screen,
              FigletText("I'm", "banner3"),
              (screen.height - 4) // 2,
              colour=Screen.COLOUR_BLACK,
              speed=1,
              start_frame=30,
              stop_frame=50),
        Print(screen,
              FigletText("on", "banner3"),
              (screen.height - 4) // 2,
              colour=Screen.COLOUR_BLACK,
              speed=1,
              start_frame=50,
              stop_frame=70),
        Print(screen,
              FigletText("Fire!", "banner3"),
              (screen.height - 4) // 2,
              colour=Screen.COLOUR_BLACK,
              speed=1,
              start_frame=70),
    ]
    scenes.append(Scene(effects, 100))

    text = Figlet(font="banner", width=200).renderText("ASCIIMATICS")
    width = max([len(x) for x in text.split("\n")])

    effects = [
        Print(screen,
              Fire(screen.height, 80, text, 0.4, 40, screen.colours),
              0,
              speed=1,
github peterbrittain / asciimatics / samples / fire.py View on Github external
start_frame=50,
              stop_frame=70),
        Print(screen,
              FigletText("Fire!", "banner3"),
              (screen.height - 4) // 2,
              colour=Screen.COLOUR_BLACK,
              speed=1,
              start_frame=70),
    ]
    scenes.append(Scene(effects, 100))

    text = Figlet(font="banner", width=200).renderText("ASCIIMATICS")
    width = max([len(x) for x in text.split("\n")])

    effects = [
        Print(screen,
              Fire(screen.height, 80, text, 0.4, 40, screen.colours),
              0,
              speed=1,
              transparent=False),
        Print(screen,
              FigletText("ASCIIMATICS", "banner"),
              screen.height - 9, x=(screen.width - width) // 2 + 1,
              colour=Screen.COLOUR_BLACK,
              bg=Screen.COLOUR_BLACK,
              speed=1),
        Print(screen,
              FigletText("ASCIIMATICS", "banner"),
              screen.height - 9,
              colour=Screen.COLOUR_WHITE,
              bg=Screen.COLOUR_WHITE,
              speed=1),
github peterbrittain / asciimatics / samples / credits.py View on Github external
def _credits(screen):
    scenes = []

    text = Figlet(font="banner", width=200).renderText("ASCIIMATICS")
    width = max([len(x) for x in text.split("\n")])

    effects = [
        Print(screen,
              Fire(screen.height, 80, text, 0.4, 40, screen.colours),
              0,
              speed=1,
              transparent=False),
        Print(screen,
              FigletText("ASCIIMATICS", "banner"),
              screen.height - 9, x=(screen.width - width) // 2 + 1,
              colour=Screen.COLOUR_BLACK,
              bg=Screen.COLOUR_BLACK,
              speed=1),
        Print(screen,
              FigletText("ASCIIMATICS", "banner"),
              screen.height - 9,
              colour=Screen.COLOUR_WHITE,
              bg=Screen.COLOUR_WHITE,
              speed=1),
    ]
    scenes.append(Scene(effects, 100))

    effects = [
        Matrix(screen, stop_frame=200),
github peterbrittain / asciimatics / samples / credits.py View on Github external
effects = [
        Print(screen,
              SpeechBubble("Press 'X' to exit."), screen.height // 2 - 1, attr=Screen.A_BOLD)
    ]
    scenes.append(Scene(effects, -1))

    screen.play(scenes, stop_on_resize=True)


if __name__ == "__main__":
    while True:
        try:
            Screen.wrapper(_credits)
            sys.exit(0)
        except ResizeScreenError:
            pass
github peterbrittain / asciimatics / samples / simple.py View on Github external
def demo(screen):
    effects = [
        Cycle(
            screen,
            FigletText("ASCIIMATICS", font='big'),
            screen.height // 2 - 8),
        Cycle(
            screen,
            FigletText("ROCKS!", font='big'),
            screen.height // 2 + 3),
        Stars(screen, (screen.width + screen.height) // 2)
    ]
    screen.play([Scene(effects, 500)])


Screen.wrapper(demo)