首页| JavaScript| HTML/CSS| Matlab| PHP| Python| Java| C/C++/VC++| C#| ASP| 其他|
购买积分 购买会员 激活码充值

您现在的位置是:虫虫源码 > Python > Python的接口与麻省理工学院)

Python的接口与麻省理工学院)

  • 资源大小:8.54 kB
  • 上传时间:2021-06-29
  • 下载次数:0次
  • 浏览次数:0次
  • 资源积分:1积分
  • 标      签: python scratch

资 源 简 介

py-scratch This package enables communication between Python and Scratch using the remote sensors feature of Scratch. It has been tested using Python 2.6, 2,7 and 3.2 on a Raspberry Pi. Remember to enable remote sensors in Scratch! To do this: 1. Go to Sensing 1. Right-click on a "sensor value" 1. Select "enable remote sensor connections" Example usage: ``` 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.se

文 件 列 表

scratch-0.0.1a
distribute_setup.py
test.py
scratch.egg-info
setup.cfg
setup.py
PKG-INFO
README.txt
LICENCE.txt
.hg
MANIFEST.in
scratch
CHANGELOG.txt
VIP VIP
0.175002s