Hi @plabon, welcome back! Lets see if we can break this down a little…
checkBox -l “Name " -v 1 -w 65 -h 20 -cc
This the checkbox, -cc is the change command which is enacting:
textField -e -en (
checkBox -q -v artistSwitch )artist” artistSwitch;
Which its enabled state is being defined by the value recoved from:
checkBox -q -v artistSwitch
This seems to make sense in the second part:
getenv "USERNAME" -w 340 -ebg 0 -enable 1 artist;
A text field text is set using the environment variable USERNAME, with a width of 340, no background and enabled state set to True,
Ok so the artistSwitch checkbox state triggers a textfield artist which it’s enabled state is set based on the state of the artistSwitch itself. So a check box enables the state of a text field based on its state. This textfield’s text is the enviroment variable USERNAME.
So layman speak - you enable/disable a checkbox which pops up a textfield with a username thats editable or not based on the state of the checkbox.
return cmds.checkBox("artistSwitch", query=True, value=True)
cmds.textField("artist", edit=True, enabled=_check_state())
cmds.textField("artist", text=cmds.getenv("USERNAME"), width=340, enableBackground=False, enable=True)
cmds.checkbox("artistSwitch", label="Name", value=True, width=65, height=20, changeCommand=change_command)