summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTechnoboy10 <technoboy10@users.noreply.github.com>2014-08-06 11:31:21 -0400
committerTechnoboy10 <technoboy10@users.noreply.github.com>2014-08-06 11:31:21 -0400
commitf5b030edcaabfd0d964adfb1dec5bcc93ed24f29 (patch)
tree590781c473999f7b2ab31d074e460cc8f1f2422c
parent9c99423a780cd2460cdafaf47b134108897fba5e (diff)
downloadblockext-f5b030edcaabfd0d964adfb1dec5bcc93ed24f29.tar.gz
blockext-f5b030edcaabfd0d964adfb1dec5bcc93ed24f29.zip
Update tutorial.rst
Started updating stuff to blockext 0.2
-rw-r--r--doc/tutorial.rst31
1 files changed, 14 insertions, 17 deletions
diff --git a/doc/tutorial.rst b/doc/tutorial.rst
index 2a67371..5167a87 100644
--- a/doc/tutorial.rst
+++ b/doc/tutorial.rst
@@ -18,29 +18,26 @@ Example
-------
Blockext is a Python module that makes writing extensions for these block-based
-programming languages much, much easier. It probably couldn't get any easier.
+programming languages fairly easy.
Here's a quick example::
from blockext import *
+
+ class Extension:
+ def __init__(self):
+ light = False
- light = False
-
- @command("press light switch %n times")
- def toggle_light(times=1):
- global light
- for i in range(times):
- light = not light
-
- @predicate("light is on?")
- def is_light_on():
- return light
+ def toggle_light(times=1):
+ global light
+ for i in range(times):
+ light = not light
- menu("city", ["Barcelona", "Boston", "Brighton"])
+ def is_light_on():
+ return light
- @reporter("weather forecast for %m.city")
- def forecast(city="Boston"):
- import random
- return random.choice(["windy", "snowy", "sunny"])
+ def forecast(city="Boston"):
+ import random
+ return random.choice(["windy", "snowy", "sunny"])
run("Tutorial Example", "example", 5000)