Skip to content

Instantly share code, notes, and snippets.

@gregtemp
Created June 16, 2014 16:51
Show Gist options
  • Save gregtemp/2e15801d1f9629c35c88 to your computer and use it in GitHub Desktop.
Save gregtemp/2e15801d1f9629c35c88 to your computer and use it in GitHub Desktop.
Learning about windows and stuff - Maya Python Mel
#from here - http://stackoverflow.com/questions/12309634/maya-python-how-to-close-a-custom-ui-window-after-the-user-has-pressed-enter
import maya.utils # you need this line!
class ReUI():
def __init__(self):
renUI = 'renUI'
if cmds.window(renUI, exists = True):
cmds.deleteUI(renUI)
renUI = cmds.window(renUI, t = 'JT Rename UI', sizeable = True, tb = True, mnb = False, mxb = False, menuBar = True, tlb = False, nm = 5)
form = cmds.formLayout()
rowA = cmds.rowColumnLayout(w = 350, h = 30)
item = cmds.ls(os = True)[0]
#def ren():
def renFc(self):
print 'yes'
#tval = cmds.textField(txtA, text = True, q = True)
#cmds.rename(item, tval)
#maya.utils.executeDeferred("cmds.deleteUI('renUI')") # and this one!
def foo(self):
print 'noooo'
txtA = cmds.textField(w = 345, h = 28, text = item, ec = foo, aie = True)
#ren()
#maya.utils.executeDeferred("cmds.deleteUI('renUI')") # and this one!
cmds.showWindow(renUI)
r = ReUI()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment