enable.coordinate_box module

class enable.coordinate_box.CoordinateBox[source]

Bases: traits.has_traits.HasTraits

Represents a box in screen space, and provides convenience properties to access bounds and coordinates in a variety of ways.

Primary attributes (not properties):

position : [x, y] bounds : [width, height]

Secondary attributes (properties):

x, y : coordinates of the lower-left pixel of the box x2, y2 : coordinates of the upper-right pixel of the box width : the number of horizontal pixels in the box; equal to x2-x+1 height : the number of vertical pixels in the box; equal to y2-y+1

Note that setting x and y will modify the position, but setting any of the other secondary attributes will modify the bounds of the box.

as_coordinates()[source]

Returns a 4-tuple (x, y, x2, y2)

is_in(x, y)[source]

Returns if the point x,y is in the box