用Pymel里的with来些UI
来源:互联网 发布:网络机房空调 编辑:程序博客网 时间:2024/06/16 22:00
第一次看到一个同事用with写UI的时候,感觉好神奇,原来with还可以这样用啊,顿感自己好无知,今天在看Pymel的文档时,才返现原来那么好的范例就放在那里,自己没有发现啊,今天狠狠地补了一下这方面的知识。同时,如果对UI里的某一类control想做某方面的统一样式,如宽度、高度、边框等等,就可以定义个template,以后所有UI里的control都会自动统一到template,不用每次自定义了,更快捷方便。最后pymel的horizontalLayout和他的redistribute()为pymel自定义的部件和方法,也很好h.redistribute(3, 3, 2)。
from pymel.core import *template = uiTemplate('ExampleTemplate', force=True)template.define(button, width=100, height=30, align='right')template.define(frameLayout, borderVisible=True, labelVisible=False)if window('firstWithWindow', exists = 1): deleteUI('firstWithWindow', window = True)with window('firstWithWindow', menuBar=True,menuBarVisible=True, title = 'WithWindow') as win: # start the template block with template: with columnLayout( rowSpacing=5, adj = 1 ): with frameLayout(): with columnLayout(adj = 1): button(label='One') button(label='Two') button(label='Three') with frameLayout(): with horizontalLayout() as h5: button(label = 'Push Me!') button(label = 'Pull Him!') h5.redistribute(30, 30) with frameLayout(): with optionMenu(): menuItem(label='Red') menuItem(label='Green') menuItem(label='Blue') # add a menu to an existing windowwith win: with menu(label = 'File'): menuItem(label='One') menuItem(label='Two') with subMenuItem(label='Sub'): menuItem(label='A') menuItem(label='B') menuItem(label='Three')
pymel在meya里使用起来真是快键方便,而且代码量少,还有些其他功能,自己正在看文档,后面继续更新。
最后上传一张图:
0 0
- 用Pymel里的with来些UI
- Enhancing Android UI with Custom Views 通过自定义view来让你的UI更屌!
- Qt里的.ui
- 用html来设计应用程序的UI
- IOS里UI里的控件
- IOS里UI里的控件
- cocos2d-x里的UI
- UE4里UI的使用方法
- PyMel技术集锦
- JavaFX:用CSS来美化你的UI控件
- 用Drawable来实现UI元素的间隔
- 用MXML里的tag属性来初始化继承成员
- 用Shell脚本来遍历文件夹里的所有文件
- 用反射来调用Android里的隐藏Class
- 用反射来调用Android里的隐藏Class
- Yahoo UI Library里的reset.css
- Photoshop里标注UI尺寸的工具
- 19 QT 里的Ui文件
- JavaScript设置组件不可见三种方式:display、visibility、opacity
- UML学习--1
- dede 调用栏目高级参数内的 关键字 和描述
- linux启动init的流程
- openv计时类TickMeter
- 用Pymel里的with来些UI
- 实现Java程序跨平台运行十二个注意事项
- AX2009常用例子
- phpcms整站代码分析
- 如何在CentOS 5/6上安装EPEL源
- Struts2学习笔记四:struts.xml
- java从Eclipse的Console中读取数据(尤其汉字)遇到的问题
- 【PMP考试难点辨析】质量管理三大过程剖析及易错题总结(丁仿)
- 2000-使用Hive的正则解析器RegexSerDe分析Nginx日志