Issue Creating Text Generation Tool in Maya


#1

Hey folks, thanks for taking the time to read this! Soooooooo…I’m trying to create a text generation tool in Maya using text curves, but I can’t seem to get it to work. The idea is that I enter text into the tool, and after pressing the “Create Text” button, that text would turn into a textcurve piece of geometry, but no matter what I do, I seem to get errors.

Is there any chance somebody might know what I can do to remedy the situation?

Thanks for taking the time to read this! Cheers!

import sys
import os
import maya.cmds as mc
outputText = ‘Hello World’
def UI ():
if mc.window(‘textGenerator’, exists = True):
mc.deleteUI(‘textGenerator’)
mc.window(‘textGenerator’)
mc.columnLayout()
mc.text('Enter text here: ')
mc.textFieldGrp()
mc.button(label = ‘Create Text’, command = ‘buttonPress()’)
mc.showWindow(‘textGenerator’)
def buttonPress():
finalName = mc.textFieldGrp()
mc.textCurves(finalName)
sys.stdout.write (outputText)

  mc.textCurves(t=outputText)

UI()