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

### Navigation

- index
- modules |
- previous |
- PLink 1.4 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`(root=None, no_arcs=False, callback=None, cb_menu=u'', file_name=None, title=u'PLink Editor')

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

  `BB_framing`()

    Return the standard meridian-longitude coordinates of the blackboard longitude (i.e. the peripheral element obtained by following the top of a tubular neighborhood of the knot).

  `BB_info`()

    Displays the meridian-longitude coordinates of the blackboard longitudes of the components of the link

  `DT_alpha`()

    Displays an alphabetical Dowker-Thistlethwaite code, as used in the knot tabulations.

  `DT_code`(alpha=False, signed=True, return_sizes=False)

    Return the Dowker-Thistlethwaite code as a list of tuples of even integers. Requires that all components be closed.

    If alpha is set to True, this method returns the alphabetical Dowker-Thistlethwaite code as used in Oliver Goodman’s Snap and in the tabulations by Jim Hoste and Morwen Thistlethwaite.

    If return_sizes is set to True, a list of the number of crossings in each component is returned (this is for use by Gauss_code).

  `DT_normal`()

    Displays a Dowker-Thistlethwaite code as a list of tuples of signed even integers.

  `Gauss_code`()

    Return a Gauss code for the link. The Gauss code is computed from a DT code, so the Gauss code will use the same indexing of crossings as is used for the DT code. Requires that all components be closed.

  `Gauss_info`()

    Displays a Gauss code as a list of tuples of signed integers.

  `PD_code`()

    Return the PD (Planar Diagram) code for the link projection, as a list of 4-tuples.

  `PD_info`()

    Displays a PD code as a list of 4-tuples.

  `SnapPea_KLPProjection`()

    Constructs a python simulation of a SnapPea KLPProjection (Kernel Link Projection) structure. See Jeff Weeks’ SnapPea file link_projection.h for definitions. Here the KLPCrossings are modeled by dictionaries. This method requires that all components be closed. A side effect is that the KLP attributes of all crossings are updated.

    The following excerpt from link_projection.h describes the main convention:

    If you view a crossing (from above) so that the strands go in the direction of the positive x- and y-axes, then the strand going in the x-direction is the KLPStrandX, and the strand going in the y-direction is the KLPStrandY. Note that this definition does not depend on which is the overstrand and which is the understrand:

        KLPStrandY
            ^
            |
        ----+---> KLPStrandX
            |
            |

  `SnapPea_projection_file`()

    Returns a string containing the contents of a SnapPea link projection file.

  `about`()
  `adjust_colors`()

    Recolors and redraws all components, in DT order, and displays the legend linking colors to cusp indices.

  `alert`()
  `arrow_components`(include_isolated_vertices=False)

    Returns a list of components, given as lists of arrows. The closed components are sorted in DT order if they have been marked. The others are sorted by age.

  `build_menus`()
  `clear`()
  `clear_text`()
  `clicked_on_arrow`(vertex)
  `create_colors`()
  `crossing_components`()

    Returns a list of lists of ECrossings, one per component, where the corresponding crossings are ordered consecutively through the component. Requires that all components be closed.

  `cursor_on_arrow`(point)
  `destroy_arrow`(arrow)
  `do_callback`()
  `done`()
  `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`()
  `hide_DT`()
  `howto`()
  `initialize`()
  `key_press`(event)

    Handler for keypress events.

  `load`(file_name=None)
  `make_alternating`()

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

  `mouse_moved`(event)

    Handler for mouse motion events.

  `not_done`()
  `notice_focus`()
  `polylines`()

    Returns a list of lists of polylines, one per component, that make up the drawing of the link diagram. Each polyline is a list of coordinates [(x0,y0), (x1,y1), ...] Isolated vertices are ignored.

  `reflect`()
  `reopen`()
  `save`()
  `save_image`(color_mode=u'color')
  `set_info`()
  `show_DT`()

    Display the DT hit counters next to each crossing. Crossings that need to be flipped for the planar embedding have an asterisk.

  `single_click`(event)

    Event handler for mouse clicks.

  `sorted_components`()

    Returns a list of crossing components which have been sorted and cyclically permuted, following the scheme used in “standard” DT codes.

    The sorting process also sets the hit counters on all crossings, for use in computing DT and Gauss codes, and sets the component attribute of each arrow in each component.

    Requires that all components be closed.

  `update_crossings`(this_arrow)
  `update_crosspoints`()
  `update_info`()
  `verify_drag`()
  `warn_arcs`()
  `write_text`(string)
  `zoom_in`()
  `zoom_out`()
  `zoom_to_fit`()

class `plink.` `Arrow`(start, end, canvas=None, hidden=False, color=u'black')

  An arrow in a PL link diagram.

  `draw`(crossings=[], recurse=True, skip_frozen=True)
  `epsilon` = 12
  `erase`()

    Prepare the arrow for the garbage collector.

  `expose`(crossings=[])
  `find_segments`(crossings, split_at_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 either near crossings where this arrow goes under, leaving a gap between the endpoint and the crossing point. If the split_at_overcrossings flag is True, then the segments are also split at overcrossings, with no gap.

  `freeze`()
  `hide`()
  `reverse`(crossings=[])
  `set_color`(color)
  `set_end`(vertex, crossings=[])
  `set_start`(vertex, crossings=[])
  `too_close`(vertex)
  `vectorize`()

class `plink.` `Crossing`(over, under)

  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.` `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`()

### Navigation

- index
- modules |
- previous |
- PLink 1.4 documentation »