SOLVED help claims that guideline.selected exists but does not

  • I know that this is probably not a way how to get active guideline, but the help says it is.

    g = CurrentGlyph()
    for guideline in g.guidelines:
     |  Data descriptors inherited from fontParts.base.base.SelectionMixin:
     |  selected
     |      The object's selection state.
     |          >>> obj.selected
     |          False
     |          >>> obj.selected = True

  • hello @jansindl3r,

    the current guideline is only available from an interactive tool.

    here’s an example: (shift-click guide to flip direction)

    from import EditingTool, installTool
    class FlipGuideTool(EditingTool):
        def getToolbarTip(self):
            return "flip guide"
        def mouseDown(self, point, clickCount):
            g = CurrentGlyph()
            guides = CurrentGuidelines()
            if guides and self.shiftDown:
                guides[0].angle += 90


  • Maybe it is not clear to me, but should be the active guideline in the sender argument of function testje? I want to right click the guideline and flip it horizontally or vertically.

    from import addObserver, clearObservers
    # clearObservers()
    class Test(object):
        def __init__(self):
            addObserver(self, "guideAdditionContextualMenuItems", "guideAdditionContextualMenuItems")
        def guideAdditionContextualMenuItems(self, notification):
            myMenuItems = [
                ("testje", self.testje), 
        def testje(self, sender):

  • admin

    you can add a item in the guideline contextual menu by subscribing to the notification: guideAdditionContextualMenuItems and append a tuple of (menu titles, callback) to additionContextualMenuItems key in the notification object.

    see observers.guideAdditionContextualMenuItems

  • how do you get the activated guideline, then? If I right click and want to have contextual action for this specific guideline? right clicked == dragged?

  • admin

    in RF a guide is only selected during a drag... so in all other cases they are not selected!

  • hi @jansindl3r,

    guidelines currently don’t implement the selected attribute in RF.

    not sure if there’s a reason behind it… seems like it could be useful? @frederik