parameters: (self, begin, end, radius=1, color=0xFFFFFF)
docstring: Draw a list of lines on canvas.
  
          Args:
              begin (numpy.array): The positions of one end of lines.
              end (numpy.array): The positions of the other end of lines.
              radius (Union[Number, numpy.array], optional): The width of lines.
                  Can be either a single width or a list of width whose shape matches
                  the shape of begin & end. Default is 1.
              color (Union[int, numpy.array], optional): The color or colors of lines.
                  Can be either a single color or a list of colors whose shape matches
                  the shape of begin & end. Default is 0xFFFFFF.
docstring_summary: Draw a list of lines on canvas.
docstring_tokens: Draw a list of lines on canvas .
function: def lines(self, begin, end, radius=1, color=0xFFFFFF):
          """Draw a list of lines on canvas.
  
          Args:
              begin (numpy.array): The positions of one end of lines.
              end (numpy.array): The positions of the other end of lines.
              radius (Union[Number, numpy.array], optional): The width of lines.
                  Can be either a single width or a list of width whose shape matches
                  the shape of begin & end. Default is 1.
              color (Union[int, numpy.array], optional): The color or colors of lines.
                  Can be either a single color or a list of colors whose shape matches
                  the shape of begin & end. Default is 0xFFFFFF.
  
          """
          assert begin.shape == end.shape
          n = begin.shape[0]
          if len(begin.shape) == 3:
              assert begin.shape[2] == 1
              begin = begin[:, :, 0]
              end = end[:, :, 0]
  
          assert begin.shape == (n, 2)
          begin = np.ascontiguousarray(begin.astype(np.float32))
          end = np.ascontiguousarray(end.astype(np.float32))
          # Note: do not use "begin = int(begin.ctypes.data)" here
          # Otherwise begin will get garbage collected by Python
          # and the pointer to its data becomes invalid
          begin_ptr = int(begin.ctypes.data)
          end_ptr = int(end.ctypes.data)
  
          if isinstance(color, np.ndarray):
              assert color.shape == (n, )
              color = np.ascontiguousarray(color.astype(np.uint32))
              color_array = int(color.ctypes.data)
              color_single = 0
          elif isinstance(color, int):
              color_array = 0
              color_single = color
          else:
              raise ValueError(
                  'Color must be an ndarray or int (e.g., 0x956333)')
  
          if isinstance(radius, np.ndarray):
              assert radius.shape == (n, )
              radius = np.ascontiguousarray(radius.astype(np.float32))
              radius_array = int(radius.ctypes.data)
              radius_single = 0
          elif isinstance(radius, numbers.Number):
              radius_array = 0
              radius_single = radius
          else:
              raise ValueError('Radius must be an ndarray or float (e.g., 0.4)')
  
          self.canvas.paths_batched(n, begin_ptr, end_ptr, color_single,
                                    color_array, radius_single, radius_array)
function_tokens: def lines ( self , begin , end , radius = 1 , color = 0xFFFFFF ) : assert begin . shape == end . shape n = begin . shape [ 0 ] if len ( begin . shape ) == 3 : assert begin . shape [ 2 ] == 1 begin = begin [ : , : , 0 ] end = end [ : , : , 0 ] assert begin . shape == ( n , 2 ) begin = np . ascontiguousarray ( begin . astype ( np . float32 ) ) end = np . ascontiguousarray ( end . astype ( np . float32 ) ) # Note: do not use "begin = int(begin.ctypes.data)" here # Otherwise begin will get garbage collected by Python # and the pointer to its data becomes invalid begin_ptr = int ( begin . ctypes . data ) end_ptr = int ( end . ctypes . data ) if isinstance ( color , np . ndarray ) : assert color . shape == ( n , ) color = np . ascontiguousarray ( color . astype ( np . uint32 ) ) color_array = int ( color . ctypes . data ) color_single = 0 elif isinstance ( color , int ) : color_array = 0 color_single = color else : raise ValueError ( 'Color must be an ndarray or int (e.g., 0x956333)' ) if isinstance ( radius , np . ndarray ) : assert radius . shape == ( n , ) radius = np . ascontiguousarray ( radius . astype ( np . float32 ) ) radius_array = int ( radius . ctypes . data ) radius_single = 0 elif isinstance ( radius , numbers . Number ) : radius_array = 0 radius_single = radius else : raise ValueError ( 'Radius must be an ndarray or float (e.g., 0.4)' ) self . canvas . paths_batched ( n , begin_ptr , end_ptr , color_single , color_array , radius_single , radius_array )