Pencil Points Afterimages Lines Polylines Polygons Smoothed Polylines Smoothed Polygons Rainbow Palette Hot Iron Palette Source |
Pencil - Points This first pencil shows two points bouncing around inside a window. The points are drawn in a Tk canvas widget using the oval item types. Every pause milliseconds, the coordinates, x and y, of the ovals are updated by adding finite displacements, dx and dy. If any updated coordinate falls outside the bounding box of the window, then we reflect the velocity for that component and adjust the updated coordinate as if it had bounced off the wall. |