Line

Line objects are created using the following functions.  Lines are drawn between a starting point (x1, y1) and an ending point (x2, y2).

Function Description
Line(x1, y1, x2, y2) Creates a line from point x1, y1, to point x2, y2.
Line(x1, y1, x2, y2, color, thickness) Creates a line from point x1, y1, to point x2, y2,. Additional optional parameters include color (e.g. Color.BLACK (default), Color.ORANGE or Color(255, 0, 255), using specific RGB values), and thickness (default is 1 pixel).

Once a Line has been created, it may be added to a Display.

line1 = Line(100, 100, 200, 200)
display1.add(line1)

Finally, you may use the following functions:

Function Description
line1.setColor(color) Changes color to the specified color (e.g. Color.BLACK or Color(255, 0, 255), using specific RGB values).  If the color parameter is omitted, a color selection dialog box will be presented.
line1.getColor() Returns the current color.
line1.getX() Returns the x coordinate (in pixels).
line1.getY() Returns the y coordinate (in pixels).
line1.setX(x) Sets the x coordinate (in pixels).
line1.setY(y) Sets the y coordinate (in pixels).
line1.encloses(other) Returns True if line1 encloses other graphics object.
line1.intersects(other) Returns True if line1 intersects other graphics object.
line1.getPosition() Returns the position as an (x, y) tuple. This is the top-left corner of the box that encloses the line.
line1.setPosition(x, y) Sets the position to x, y. This is the top-left corner of the box that encloses the line.