与mit scratch 1.3+接口的python(不是2.x)
scratch的Python项目详细描述
这个包支持python和scratch 1.3+之间的通信(不是2.x) 使用远程传感器的scratch功能。
记住要启用远程传感器!为此:
- 转到传感
- 右键单击“传感器值”
- 选择“启用遥感器连接”
示例用法:
import scratch s = scratch.Scratch() # to make a broadcast to scratch s.broadcast("from python") # to receive an update from scratch message = s.receive() # blocks until an update is received # message returned as {'broadcast': [], 'sensor-update': {'scratchvar': '64'}} # or {'broadcast': ['from scratch'], 'sensor-update': {}} # where scratchvar is the name of a variable in scratch # and 'from scratch' is the name of a scratch broadcast # send sensor updates to scratch data = {} data['pyvar'] = 123 for data['pycounter'] in range(60): s.sensorupdate(data)
0.0.1a
初始版本
1.0.0
首次发布-模块从0.0.1a保持不变