plink – A Python/Tk link editor — PLink 2.4.9 documentation

# plink – A Python/Tk link editor

Technical documentation of the Python objects that underly PLink. Of interest only to Marc, Nathan, or similar folks.

class plink.LinkEditor(*args, **kwargs)

  A complete graphical link drawing tool based on the one embedded in Jeff Weeks’ original SnapPea program.

  active_crossing_data()

    Return the tuple of edges crossed by the in and out arrows of the active vertex.

  attach_cursor(reason='')
  clear()
  clicked_on_arrow(vertex)
  crossed_arrows(arrow, ignore_list=[])

    Return a tuple containing the arrows of the diagram which are crossed by the given arrow, in order along the given arrow.

  cursor_on_arrow(point)
  destroy_arrow(arrow)
  detach_cursor(reason='')
  done(event=None)
  double_click(event)

    Event handler for mouse double-clicks.

  end_dragging_state()
  focus_in(event)
  focus_out(event)
  generic_arrow(arrow)
  generic_vertex(vertex)
  goto_drawing_state(x1, y1)
  goto_start_state()
  make_alternating()

    Changes crossings to make the projection alternating. Requires that all components be closed.

  mouse_moved(event)

    Handler for mouse motion events.

  move_active(x, y)
  move_is_ok()
  notice_focus()
  reflect()
  set_start_cursor(x, y)
  shift_click(event)

    Event handler for mouse shift-clicks.

  single_click(event)

    Event handler for mouse clicks.

  update_crossings(this_arrow)

    Redraw any arrows which were changed by moving this_arrow.

  verify_drag()

This module exports the class Arrow which represents a (directed) line segment in a PL link diagram.

class plink.arrow.Arrow(start, end, canvas=None, style='normal', color='black', other_params=None)

  An arrow in a PL link diagram.

  default_params = {'abs_gap_size': 9.0, 'arrow_shape': (10, 15, 5), 'double_gap_at_ends': True, 'include_overcrossings': False, 'no_arrow_size': 40, 'rel_gap_size': 0.3}
  draw(crossings=[], recurse=True, skip_frozen=True)
  epsilon = 8
  erase()

    Prepare the arrow for the garbage collector.

  expose(crossings=[])
  find_segments(crossings, include_overcrossings=False)

    Return a list of segments that make up this arrow, each segment being a list of 4 coordinates [x0,y0,x1,y1]. The first segment starts at the start vertex, and the last one ends at the end vertex. Otherwise, endpoints are near crossings where this arrow goes under, leaving a gap between the endpoint and the crossing point. If the include_overcrossings flag is True, then the segments are also split at overcrossings, with no gap.

  freeze()
  property frozen
  property hidden
  hide()
  make_faint()
  reverse(crossings=[])
  scale_factor = 1
  scale_set = False
  set_color(color)
  set_end(vertex, crossings=[])
  classmethod set_scale(factor)
  set_start(vertex, crossings=[])
  too_close(vertex, tolerance=None)
  vectorize()

This module exports the Crossing class, which represents a crossing in a link diagram, and the ECrossing class which represents an edge of the diagram passing through a crossing.

class plink.crossings.Crossing(over, under, is_virtual=False, label=None)

  A pair of crossing arrows in a PL link diagram.

  DT_hit(count, ecrossing)

    Count the crossing, using DT conventions. Return True on the first hit if the count is odd and the crossing is shared by two components of the diagram. As a side effect, set the flipped attribute on the first hit.

  clear_marks()
  height(arrow)
  locate()
  mark_component(component)
  reverse()
  sign()
  strand(arrow)

class plink.crossings.ECrossing(crossing, arrow)

  A pair: (Crossing, Arrow), where the Arrow is involved in the Crossing. The ECrossings correspond 1-1 with edges of the link diagram.

  goes_over()
  pair()