#!/usr/bin/env python ### Example purdy library code # # Demonstrates the slide transition animation from purdy.actions import Append, Wait, Transition, Fold from purdy.content import Code from purdy.ui import SimpleScreen, VirtualCodeBox screen = SimpleScreen(starting_line_number=10) code_box = screen.code_box blob = Code('../display_code/simple.repl') blob2 = Code('../display_code/traceback.repl') blob3 = Code('../display_code/decorator.repl') vbox = VirtualCodeBox(starting_line_number=20, display_mode='urwid') # prep vbox for copy vbox.perform_actions([ Append(vbox, blob3), Fold(vbox, 2, 2), ]) actions = [ Append(code_box, blob2), Wait(), Transition(code_box), # test transition to empty Append(code_box, blob), Wait(),
#!/usr/bin/env python ### Example purdy library code # # Demonstrates highlighting and unhighlighting lines of code from purdy.actions import Append, Highlight, Wait from purdy.content import Code from purdy.settings import settings from purdy.ui import SimpleScreen #settings['colour'] = 16 screen = SimpleScreen(settings, starting_line_number=1) code_box = screen.code_box blob = Code('../display_code/console.repl') actions = [ Append(code_box, blob), Wait(), Highlight(code_box, range(5, 41), True), Wait(), Highlight(code_box, '5,6,10-20', False), ] if __name__ == '__main__': screen.run(actions)
#!/usr/bin/env python ### Example purdy library code # # Demonstrates the use of sections and skipping to them with "S" from purdy.builder import ActionsBuilder from purdy.ui import SimpleScreen screen = SimpleScreen() actions = (ActionsBuilder(screen, "con").append(text=">>> 1").wait().append( text=">>> 2").wait().append(text=">>> 3").wait().section().append( text=">>> 10").wait().append(text=">>> 11").wait().section().append( text=">>> 20").wait().append(text=">>> 21")) if __name__ == "__main__": screen.run(actions)
#!/usr/bin/env python ### Example purdy library code # # Demonstrates movie mode from purdy.actions import AppendTypewriter from purdy.settings import settings from purdy.content import Code from purdy.ui import SimpleScreen settings['movie_mode'] = 200 screen = SimpleScreen(settings) code_box = screen.code_box blob = Code('../display_code/console.repl') actions = [ AppendTypewriter(code_box, blob), ] if __name__ == '__main__': screen.run(actions)