Contour.index raises AttributeError



  • I'm trying to delete a contour (well, some of them) and I get an AttributeError where (I think) shouldn't as it's robofab's (and works in FL this way).

    g = CurrentGlyph()
    for con in g:
        print g.index
    

    Thanks you!



  • Well, in this case I don't need it (thought shouldn't it work?)
    I didn't find glyph.removeCountour() in robofab's documentation :[

    Thanks!


  • admin

    Why do you need the index of the contour?

    use:

    glyph = CurrentGlyph()
    ## dont remove and iterate over the same glyph object
    ## so create a temp list of contours
    contoursToRemove = list(glyph)
    
    for contour in contoursToRemove:
        glyph.removeContour(contour)