Skip to content
Kepoor Hampond edited this page Mar 19, 2017 · 7 revisions

Welcome to the draftlog wiki!

Install

You can easily install it with pip:

$ pip install draftlog

More In-Depth Examples

There's not a whole lot to go over, so it'll all be covered here.

First off, how to actually use it. So here's the simplest possible example of it actually doing something:

# First, you'll want to import it
from draftlog.draft import Draft

# Then initialize the object
d = Draft()
# Create a text interval object (we'll get to what that is later)
d.add_text("*programming pun*")
# And run it!
d.start()

Now, if we wanted to stop here, then it would run, but let's add some complexity to the text interval object:

# This time we'll assign a variable to `d.add_text`, which returns an id for finding our object.
# Also, with status as `False`, it means it won't timeout immediately
text = d.add_text("*programming pun*", status=True)
# Then with the id, we can edit the text interval object:
text.update("text", "haha what a funny joke...").update("status", False).after(3)

d.start()

Now, if this was done correctly, it should print out *programming pun* for 3 seconds and then overwrite it with haha what a funny joke.... Now, this seems like a lot of work for just rewriting a line, but there's a lot more you can do.

Let's cover what we actually did though. First, we imported the module (no surprise there). Then we initialized the Draft object (also, no big whoop). Next, we assigned the variable text to the method add_text. You'll learn that add_text is pretty much just an alias for the method Draft.add_interval (which we'll get to soon). Then we used the text variable to update our object's text after 3 seconds.

Clone this wiki locally