Toggle the visibility of a window. If no window is specified then the current window (most recently created) is used. See also the windowcommand’s vis/visibleflag.
Derived from mel command maya.cmds.toggleWindowVisibility
Example:
import pymel.core as pm
import maya.cmds as cmds
window1 = pm.window( retain=True )
pm.columnLayout()
# Result: ui.ColumnLayout('window1|columnLayout89') #
pm.checkBox()
# Result: ui.CheckBox('window1|columnLayout89|checkBox8') #
pm.checkBox()
# Result: ui.CheckBox('window1|columnLayout89|checkBox9') #
pm.checkBox()
# Result: ui.CheckBox('window1|columnLayout89|checkBox10') #
pm.button( label='Close', command='pm.window( window1, edit=True, visible=False )' )
# Result: ui.Button('window1|columnLayout89|button100') #
# Create another window with a button that will toggle the visibility
# of the first window.
#
window2 = pm.window()
pm.columnLayout()
# Result: ui.ColumnLayout('window2|columnLayout90') #
pm.button( label='Toggle Window Visibility', command=('pm.toggleWindowVisibility(\"' + window1 +'\")' ) )
# Result: ui.Button('window2|columnLayout90|button101') #
pm.showWindow( window1 )
pm.showWindow( window2 )