I wanted to learn this as well so I took a stab at it. Try this
import maya.cmds as cmds
#printedInput = (textField_command(fieldTexts))
#print printedInput
nameInput=""
addressInput=""
phoneInput=""
emailInput=""
def defaultButtonPush(fieldTexts):
print fieldTexts
controls = cmds.lsUI( controls=True, long=True)
print controls
#this finds the "MyWindows"
myWindowCtls = [ctl for ctl in controls if ctl.find('MyWindow') == 0]
print myWindowCtls
#This finds all of the items with "textfield" in the name
myTextCtls = [ctl for ctl in myWindowCtls if ctl.find('textField') != -1]
print myTextCtls
UserInput = [ (cmds.textField(text, query = True, text=True)) for text in myTextCtls]
#print "name is" + nameInput
print UserInput
print 'Button 1 was pushed.'
nameInput=UserInput[1]
print nameInput
addressInput=UserInput[2]
print addressInput
phoneInput=UserInput[3]
print phoneInput
emailInput=UserInput[0]
print emailInput
window = cmds.window("MyWindow")
cmds.rowColumnLayout( numberOfColumns=1)
#
cmds.text( label='Name' )
name = cmds.textField(aie = True,)
ec_val = 'textField_command("{}")'.format(name)
cmds.textField(name, e = True, ec = ec_val)
#
cmds.text( label='Address' )
address = cmds.textField(aie = True)
ec_val = 'textField_command("{}")'.format(address)
cmds.textField(address, e = True, ec = ec_val)
#
cmds.text( label='Phone Number' )
phoneNumber = cmds.textField(aie = True)
ec_val = 'textField_command("{}")'.format(phoneNumber)
cmds.textField(phoneNumber, e = True, ec = ec_val)
#
cmds.text( label='Email' )
email = cmds.textField(aie = True)
ec_val = 'textField_command("{}")'.format(email)
cmds.textField(email, e = True, ec = ec_val)
#
cmds.button( label='Enter', c = defaultButtonPush )
cmds.showWindow()
#textField_command(passed_value)