
A turtle spirit level or plumb bob.

The '
Acceleration' block pushes the acceleration for the x,y,z axis onto the heap, this includes gravity, resolved into these 3 components. The artan of the x and y components is the angle of the line pointing towards the lowest part of the screen.
Source
An alternate solution:
Labels: Python, Sugar, TurtleArt, TurtleBlocks