Hi, i start building a plugin, and i tried to change the text in the graphicview
my code
# -*- coding: utf-8 -*-
"""Converts make Random Text."""
import random
#print(random.choice(x))
Font = Glyphs.font
Doc = Glyphs.currentDocument
TextStoreage = Doc.windowController().activeEditViewController().graphicView().textStorage()
String = TextStoreage.text().string()
Range = Doc.windowController().activeEditViewController().graphicView().selectedRange()
if Range.length <= 0:
Range.location = 0
Range.length = len(String)
str='book pen paper pencil'
x=str.split()
charString = Font.charStringFromDisplayString_(editString)
TextStoreage.replaceCharactersInRange_withString_(Range, random.choice(x))
once the random generator repeating the pervious value the script crashes
how can i change the text directly ?
thanks