My first use of classes with Python. Very simple code which I feel may be further simplified. Please break my code or give me input on where it could have been better/efficient.import maya.cmds as mcfrom functools import partialclass MoveSelTool(object):    '''Tool for moving selected object or objects by a     value specified by user on the X, Y, and Z axis.'''    def __init__(self, *args):        pass           if(mc.window(ak_move_sel_tool_window, query=True, exists=True)):        mc.deleteUI(ak_move_sel_tool_window)    def build_window_UI(self):        '''Builds the window for GUI'''         self.window = mc.window(ak_move_sel_tool_window,                                 title=Move Selection Tool)        self.columnLayout = mc.columnLayout()        self.txt_directions = mc.text(align=left,                                     label=Directions: Input translation increment.\n)        self.rowColumn = mc.rowColumnLayout(numberOfColumns=8)        self.txt_x = mc.text(label= X: ,                             align=right)                 self.txtfld_x = mc.textField(mst_txtfld_x_value,                                    text=0,                                     ann='input units to move X',                                     width=50)        self.txt_y = mc.text(label= Y: ,                             align=right)                 self.txtfld_y = mc.textField(mst_txtfld_y_value,                                    text=0,                                      ann='input units to move Y',                                     width=50)        self.txt_z = mc.text(label= Z: ,                             align=right)                 self.txtfld_z = mc.textField(mst_txtfld_z_value,                                    text=0,                                      ann='input units to move Z',                                     width=50)        self.txt_space = mc.text(label=  )            self.move_btn = mc.button(label=Move)         #ui commands        mc.button(self.move_btn,                 edit=True,                 command=partial(self.move_selection))        mc.textField(mst_txtfld_x_value,                    edit=True,                     enterCommand=partial(self.move_selection))        mc.textField(mst_txtfld_y_value,                    edit=True,                     enterCommand=partial(self.move_selection))                     mc.textField(mst_txtfld_z_value,                    edit=True,                     enterCommand=partial(self.move_selection))        #show ui        mc.showWindow(self.window)    def query_mst_user_input(self):        '''Queries all 3 textfields and returns         values of X, Y, and Z in a single list'''        self.x_value = mc.textField(mst_txtfld_x_value,                                     query=True,                                    text=True)        self.y_value = mc.textField(mst_txtfld_y_value,                                     query=True,                                    text=True)        self.z_value = mc.textField(mst_txtfld_z_value,                                     query=True,                                    text=True)        return (self.x_value, self.y_value, self.z_value)     def move_selection(self, *args):        '''Convert input or lack thereof into floats         and plug them into Maya's move command'''        self.mst_user_selection = mc.ls(selection=True)            self.mst_user_inputs = self.query_mst_user_input()        user_x = self.mst_user_inputs[0]        user_y = self.mst_user_inputs[1]        user_z = self.mst_user_inputs[2]        print len(user_x)        if len(user_x) == 0:            user_x = 0        if len(user_y) == 0:            user_y = 0        if len(user_z) == 0:            user_z = 0                    print Your X is {0}.format(float(user_x))        print Your Y is {0}.format(float(user_y))        print Your Z is {0}.format(float(user_z))        mc.move(float(user_x),                 float(user_y),                 float(user_z),                self.mst_user_selection,                 relative=True)    def show(self):        '''Display UI'''        self.build_window_UI()mst=MoveSelTool()mst.show()
Move selection based on input for X, Y, and Z axes
python;python 2.7;maya