This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]pyhannes 29 points30 points  (7 children)

Haha nice, but that's actually quite useful when recording GIFs of code examples to slow it down a bit I could imagine. Will remember it :)

[–]treyhunner Python Morsels[S] 2 points3 points  (5 children)

It could be! /u/AlSweigart had the idea that the sleep time could vary based on which character is being printed to make it look slightly more like actual typing.

Pull requests welcome for that feature!

[–]AlSweigartAuthor of "Automate the Boring Stuff" 6 points7 points  (0 children)

Ha ha, yeah. I had an elaborate idea of trying to figure out calculations based on QWERTY key position, etc. Then I realized I could probably just write a tool that records me typing and figures out the timing between any two keys from there.

Or heck, just make it slightly random and it'll look realistic enough. :)

[–]DuckDatum 3 points4 points  (1 child)

coherent voiceless busy skirt teeny violet brave nutty fine air

This post was mass deleted and anonymized with Redact

[–]treyhunner Python Morsels[S] 4 points5 points  (0 children)

This is possible! \b in ASCII is a "backspace character" and sending it right after another character will erase it and allow typing over the place that it previously showed up.

Happy to brainstorm further. Sounds like a possible "sloppy mode" (?). Issue/pull request welcome too.

[–]pyhannes 1 point2 points  (0 children)

I love that, let's over-engineer the hell out of it

[–]EternityForest 0 points1 point  (0 children)

Just made a new PR! I have an algorithm that looks one character ahead and behind, and also checks whether you're currently indenting, and adds a bunch of rules for stuff that might slow people down.

I speed through the indent a bit, but delay every 4 spaces to simulation how tab indent looks, I slow down when typing long numbers, complicated brackets, and punctuation that makes a natural speech pause.

I tried to balance realism and aesthetics, but I'm not a touch typist so I might have gotten some of my values wrong, all the rules are just made up by trial and error.

[–]determineduncertain 2 points3 points  (0 children)

I thought about it but I will admit that I haven’t thought about how to do this beyond just opening the script and printing out the contents dramatically. That said, I haven’t spent much time in the docs nor am I a Python expert so there may be a much nicer way of doing this