neoscore.western.tab_staff

class neoscore.western.tab_staff.TabStaff[source]

Bases: AbstractStaff

A staff for writing guitar tablature with any number of strings.

This class is not suitable for use with Chordrest, Clef, TimeSignature, and other such classes dependent on classical staff semantics.

While TabStaff has a MusicFont, its unit does not necessarily correspond to the distance between staff lines. By default, the line spacing is wider than classical staves, and its MusicFont is sized to 2/3 that spacing.

__init__(pos: PointDef, parent: Optional[PositionedObject], length: Unit, group: Optional[StaffGroup] = None, line_spacing: Unit = Mm(2.5), line_count: int = 6, music_font: Optional[MusicFont] = None, pen: Optional[Pen] = None)[source]
Parameters
  • pos – The position of the top-left corner of the staff

  • parent – The parent for the staff. Make this a Flowable to allow the staff to run across line and page breaks.

  • length – The horizontal width of the staff

  • group – The staff group this belongs to. Set this if being used in a system of multiple staves.

  • line_spacing – The distance between two lines in the staff.

  • line_count – The number of lines in the staff.

  • music_font – The font to use for MusicText objects in the staff. Unlike in Staff, this font’s unit is not necessarily equivalent to the space between two staff (string) lines. By default, this will use the system-wide default music font with a unit sized to 2/3 the staff line spacing.

  • pen – The pen used to draw the staff lines. Defaults to a line with thickness from the music font’s engraving default.

string_y(string: int) Unit[source]

Return the Y position of a given string’s line.

Strings are indicated from 1 to N, where 1 is the top string and N is the bottom.

property font_to_staff_space_ratio: float

Conversion ratio between the font’s unit and the staff line spacing.

clefs

All the clefs in this staff, ordered by their relative x pos.

active_clef_at(pos_x: Unit) Optional[TabClef][source]

Return the active clef at a given x position, if any.

register_layout_controllers()[source]

Register any flowable margin controllers needed by the staff.

Staff subclasses must implement this.

fringe_layout_for_isolated_staff(location: Optional[NewLine]) StaffFringeLayout[source]

Determine the staff fringe layout of this staff in isolation.

This is the layout needed if this staff was alone in a staff system. StaffGroup uses this as a starting point in its fringe layout logic.

Staff subclasses must implement this.