Calico Python

From IPRE Wiki
Jump to: navigation, search

Calico Python is implemented using IronPython, with a custom built set of modules for cross-platform compatibility.

Most anything that you can do in any Python, you can do in the Calico environment.

For a complete textbook using Calico with Python, please see Learning Computing With Robots Using Calico Python.

To get started with using robots with Python, use Calico Myro:

python> from Myro import *
python> init("COM5")
python> beep(1, 440)

To get started with Calico Graphics:

python> from Graphics import *
python> win = Window("Hello, World!")

We have tried to make Calico Python as close to Python3 as possible. That includes the following points:

  • print is a function, so you must call it with parentheses: print("Hello, World!")
  • Division "/" is real division: 3/4 gives 0.75
  • There is no "raw_input"; use eval(input("Enter a number:"))
  • The input function will open a window in order to get input.

Additional Libraries

The following are additional libraries that are only accessible through Python. These are beyond the regular Python Libraries; Calico Python comes with all of the standard libraries that Python 2.7 comes with.


Local Python Libraries

If you would like to add additional Python libraries to Python, put them in:


calico object

There is a special object in the environment, calico. It has access to a variety of Calico functions. See Calico: calico object for more details.