# 需要导入模块: from maya import cmds [as 别名]

# 或者: from maya.cmds import shelfButton [as 别名]

def createShelfButton(command, label='', name=None, description='',

image=None, #the default image is a circle

labelColor=(1, 0.5, 0),

labelBackgroundColor=(0, 0, 0, 0.5),

backgroundColor=None

):

'''

Create a shelf button for the command on the current shelf

'''

#some good default icons:

#menuIconConstraints - !

#render_useBackground - circle

#render_volumeShader - black dot

#menuIconShow - eye

gShelfTopLevel = mm.eval('$temp=$gShelfTopLevel')

if not mc.tabLayout(gShelfTopLevel, exists=True):

OpenMaya.MGlobal.displayWarning('Shelf not visible.')

return

if not name:

name = label

if not image:

image = getIcon(name)

if not image:

image = 'render_useBackground'

shelfTab = mc.shelfTabLayout(gShelfTopLevel, query=True, selectTab=True)

shelfTab = gShelfTopLevel+'|'+shelfTab

#add additional args depending on what version of maya we're in

kwargs = {}

if MAYA_VERSION >= 2009:

kwargs['commandRepeatable'] = True

if MAYA_VERSION >= 2011:

kwargs['overlayLabelColor'] = labelColor

kwargs['overlayLabelBackColor'] = labelBackgroundColor

if backgroundColor:

kwargs['enableBackground'] = bool(backgroundColor)

kwargs['backgroundColor'] = backgroundColor

return mc.shelfButton(parent=shelfTab, label=name, command=command,

imageOverlayLabel=label, image=image, annotation=description,

width=32, height=32, align='center', **kwargs)

python中button对象的方法_Python cmds.shelfButton方法代码示例相关推荐

  1. python中tmp是什么函数_Python os.tmpfile()方法

    Python os.tmpfile()方法 概述 os.tmpfile() 方法用于返回一个打开的模式为(w+b)的临时文件对象,这文件对象没有文件夹入口,没有文件描述符,将会自动删除. 语法 tmp ...

  2. python中如何定义一个数组_Python数组定义方法

    本文实例讲述了Python数组定义方法.分享给大家供大家参考,具体如下: Python中没有数组的数据结构,但列表很像数组,如: a=[0,1,2] 这时:a[0]=0, a[1]=1, a[[2]= ...

  3. python中startout是什么意思_Python socket.timeout方法代碼示例

    本文整理匯總了Python中gevent.socket.timeout方法的典型用法代碼示例.如果您正苦於以下問題:Python socket.timeout方法的具體用法?Python socket ...

  4. python中uppercase是什么意思_Python string.ascii_uppercase方法代码示例

    本文整理汇总了Python中string.ascii_uppercase方法的典型用法代码示例.如果您正苦于以下问题:Python string.ascii_uppercase方法的具体用法?Pyth ...

  5. python中right是什么意思_Python turtle.right方法代码示例

    本文整理汇总了Python中turtle.right方法的典型用法代码示例.如果您正苦于以下问题:Python turtle.right方法的具体用法?Python turtle.right怎么用?P ...

  6. python中uniform(a、b)_Python stats.uniform方法代码示例

    本文整理汇总了Python中scipy.stats.uniform方法的典型用法代码示例.如果您正苦于以下问题:Python stats.uniform方法的具体用法?Python stats.uni ...

  7. python中uppercase是什么意思_Python string.uppercase方法代码示例

    本文整理汇总了Python中string.uppercase方法的典型用法代码示例.如果您正苦于以下问题:Python string.uppercase方法的具体用法?Python string.up ...

  8. python中图例legend标签内容_matplotlib设置legend图例代码示例

    matplotlib设置legend图例代码示例 本文主要是关于matplotlib的一些基本用法. Demo import matplotlib.pyplot as plt import numpy ...

  9. python中星号怎么打出来_Python打印“菱形”星号代码方法

    本人是一名python初学者,刚刚看到一道有趣的python问题,"用python如何在编译器中打印出菱形图案?" 因此决定尝试一下,代码不多,仅供参考. 代码 def print ...

最新文章

  1. Java操作Kafka执行不成功
  2. 解决json包含html标签无法显示的问题
  3. 一步步学习SPD2010--第十一章节--处理母版页(10)--重置母版页到网站定义
  4. 2.2 清除标注错误的数据-深度学习第三课《结构化机器学习项目》-Stanford吴恩达教授
  5. jQuery使用ajax传输xml文档在IE中无法正确解析的问题
  6. 简历要求中“ 扎实的JAVA基础”的学习方法
  7. c语言中如何让鼠标在一个窗口之外不能点击_Excel系列教程:如何自动填充单元格...
  8. 面试了一个31岁程序员,让我有所触动
  9. linux文件句柄数
  10. python 包的使用 (三)——turtle:使用海龟图形(turtle graphics)绘制图像
  11. 遗传算法python实例_Python遗传算法框架使用实例(一)使用Geatpy实现句子匹配
  12. dataformatstring(DataFormatString 文本)
  13. python破解加密压缩包
  14. CCF推荐+SCI二区期刊征收AI方向特刊|确定3个月出录用结果
  15. 学计算机专业独立显卡有必要吗,独立显卡驱动有什么用(显卡驱动有必要安装吗)...
  16. ubuntu使用bitbucket
  17. MacOS 安装 gstreamer 最新版本(1.20.0)
  18. 在 vue 中使用 SVG 建立图标系统并且使用
  19. 文件包含漏洞—allow_url_fopen和allow_url_include详解
  20. 弹性盒子flex布局

热门文章

  1. SOT-23封装如何查找元件型号
  2. fuzzy仿真 MATLAB,基于MATLAB的FUZZY控制器的设计和仿真
  3. vue element table expand 扩展行点击行展示且保证只展示一行
  4. 简单介绍一下HBase、Cassandra、Voldemort、Redis、VoltDB、MySQL
  5. 扫雷小游戏(超详细)
  6. Receiver Operating Characteristic(ROC)
  7. c语言fabs函数的返回值,fabs()函数
  8. 股市投资时,寻找低市盈率标的
  9. Composer学习
  10. POWERBUILDER12.6开发实验室管理系统[LIS](四),希森美康XN-350全自动血球计数仪接口