Skip to content

Instantly share code, notes, and snippets.

@the-nerdery-dot-info
Forked from atvKumar/mkWindow.py
Created December 22, 2016 05:44
Show Gist options
  • Save the-nerdery-dot-info/8a3f27f93c1982c76277bd4824aaf66d to your computer and use it in GitHub Desktop.
Save the-nerdery-dot-info/8a3f27f93c1982c76277bd4824aaf66d to your computer and use it in GitHub Desktop.
Boiler Plate Code for Windows GUI under PyMel/Python/Maya
#-------------------------------------------------------------------------------
# Boiler Plate Code for Windows
# By : Kumaran
import pymel.core as pm
class UI(pm.uitypes.Window):
_TITLE = "mkWindow"
_LAYOUT = "mkLayout"
_DOCKCONTROL = "mkDockCtrl"
dockControl = None
def __new__(cls):
if pm.window(cls._TITLE, exists=True):
pm.deleteUI(cls._TITLE)
if(pm.dockControl(cls._DOCKCONTROL, ex=1)):
pm.deleteUI(cls._DOCKCONTROL, control=1)
self = pm.window(cls._TITLE, title=cls._TITLE)
return pm.uitypes.Window.__new__(cls, self)
def __init__(self):
form = pm.formLayout(self._LAYOUT)
self.show()
def ui_makeDockable(self):
''' make the window dockable '''
# skip if already dockable
if(self.dockControl):
pm.mel.eval('warning "%s"' % "Window already dockable!")
return
# create dockControl
self.dockControl = pm.dockControl(self._DOCKCONTROL, l=self, content=self,
area='left', allowedArea=['left', 'right'])
#
#-------------------------------------------------------------------------------
UI()
#UI().ui_makeDockable()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment