Skip to content

Instantly share code, notes, and snippets.

@marvolo3d
Created February 14, 2017 21:16
Show Gist options
  • Save marvolo3d/14c11cf3ec31cfd33b2c009a0cb46e96 to your computer and use it in GitHub Desktop.
Save marvolo3d/14c11cf3ec31cfd33b2c009a0cb46e96 to your computer and use it in GitHub Desktop.
Mari Palette
import mari
import PySide.QtGui as QtGui
class mariWidget(QtGui.QWidget):
def __init__(self):
super(mariWidget, self).__init__()
self._mainUISetup()
def _mainUISetup(self):
mainLayout = QtGui.QVBoxLayout()
self.setLayout(mainLayout)
btn_awesome = QtGui.QPushButton('awesome')
mainLayout.addWidget(btn_awesome)
# it is necessary to keep a reference to the widget in the global scope for this to work
# http://community.thefoundry.co.uk/discussion/post.aspx?f=204&t=118691&p=995770
def run():
try:
mari.palettes.remove("Cool Palette")
except:
pass
myWidget = mariWidget()
myPalette = mari.palettes.create("Cool Palette", myWidget)
return myWidget
palette = run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment