HyperMesh二次开发技术—插件界面开发(一)

1.代码实例

#新建过程subWindow

proc subWindow {} {
    toplevel .subWindow -background {black}
    wm overrideredirect .subWindow true
    wm attribute .subWindow -topmost true
    wm geometry .subWindow 296x120+300+250
    frame .subWindow.f -relief flat
    label .subWindow.f.label01 -text "" -width 1 -height 5 -background {black}
    grid .subWindow.f.label01 -column 0 -row 0 -padx 2 -sticky ew
    labelframe .subWindow.f.part01 -text "workPath" -width 25 -height 100
    label .subWindow.f.part01.label00 -text "HomeDir"  -font {arial 8 bold} -width 8
    label .subWindow.f.part01.label10 -text "" -width 20 -height 2 -relief groove -borderwidth 4
    button .subWindow.f.part01.button -text "Select" -width 5  -font {arial 8 bold}
    grid .subWindow.f.part01.label00 -column 0 -row 0 -pady 18 -padx 2 -sticky ew 
    grid .subWindow.f.part01.label10 -column 1 -row 0 -pady 18 -padx 2 -sticky ew
    grid .subWindow.f.part01.button -column 1 -row 1 -pady 5 -padx 4 -sticky e
    grid .subWindow.f.part01 -column 1 -row 0 -padx 3 -pady 1 -sticky ew
          
    labelframe .subWindow.f.part02 -text "Import/Export" -width 23 -height 100
    button .subWindow.f.part02.button00 -text "Import" -width 5 -font {arial 8 bold} 
    button .subWindow.f.part02.button01 -text "Export" -width 5 -font {arial 8 bold}
    button .subWindow.f.part02.button02 -text "-Back-" -width 5 -font {arial 8 bold} -command {destroy .subWindow}
    grid .subWindow.f.part02.button00 -column 0 -row 0 -pady 5 -padx 2 -sticky ew
    grid .subWindow.f.part02.button01 -column 0 -row 1 -pady 5 -padx 2 -sticky ew
    grid .subWindow.f.part02.button02 -column 0 -row 2 -pady 5 -padx 2 -sticky ew
    grid .subWindow.f.part02 -column 2 -row 0 -padx 3 -pady 1 -sticky ew
    pack .subWindow.f -padx 0 -pady 1
}

#调用subWindow过程
subWindow

2.代码解析

(1) toplevel .subWindow -background {black}

在HyperMesh主界面下定义目录名为".subWindow"的子窗口,背景色为 {black}。

(2) wm overrideredirect .subWindow true

其参数为"true",使窗口管理器彻底忽略一个顶层窗口:没有装饰,没有窗口管理器对窗口交互式操作,没有图标化。

(3) wm attribute .subWindow -topmost true

其"-topmost"参数为"true",设置子窗口".subWindow"总显示在最前面。

(4) wm geometry .subWindow 296x120+300+250

设置子窗口".subWindow"宽296字符,高120字符;

设置子窗口".subwindow"左上角位置为显示器坐标(300,250)像素点。

(5) frame .subWindow.f -relief flat

在子窗口下建立目录名为".subWindow.f"的框架,-relief决定框架外观,其值:raised、sunken、flat、groove、ridge。

应用"pack .subWindow.f -padx 0 -pady 1"将框架加载到子窗口上,-padx:X方向距离边界,-pady:Y方向距离边界。

(6) labelframe .subWindow.f.part01 -text "workPath" -width 25 -height 100

在框架".subWindow.f"下添加目录名为".subWindow.f.part01"的带标题框架,标题名"workPath",-width:框架宽度,-height:框架高度。

应用"grid .subWindow.f.part02 -column 2 -row 0 -padx 3 -pady 1 -sticky ew"将带标题子框架加载到框架".subWindow.f"的第2列,第0行位置。

(7) button .subWindow.f.part02.button02 -text "-Back-" -width 5 -font {arial 8 bold} -command {destroy .subWindow}

在带标题框架".subWindow.f.part02"下添加目录名为".subWindow.f.part02.button02"的button按钮,按钮标题名"-Back-",-width:按钮宽度,-font:标题字体大小,-command:点击button后执行的脚本。

应用"grid .subWindow.f.part02.button02 -column 0 -row 2 -pady 5 -padx 2 -sticky ew"将button添加到".subWindow.f.part02"框架下。

(8) subWindow

调用"subWindow"过程。

3.启动名称为"subWindow"插件

 

 

 

  • 3
    点赞
  • 35
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
HyperMesh二次开发是指在HyperMesh软件中进行自定义功能开发的过程。在学习HyperMesh二次开发时,可能会遇到一些困难,因为在最初学习时,可能找不到完整的学习资料。一些人可能只能通过软件帮助和自己摸索来学习,这个过程可能会很痛苦,有时候为了实现一个简单的功能,需要翻遍帮助文档和查询网络,但仍然找不到合适的处理方法,这可能会让人怀疑自己的能力。然而,只要坚持下来,通过不断的学习和实践,就能掌握绝大多数的HyperMesh开发项目。\[1\] 有些人为了分享自己在HyperMesh二次开发学习中的经验总结,帮助有兴趣学习HyperMesh二次开发的同学快速掌握开发知识,以及提供一个技术交流的平台,开设了一些教程专栏。这些教程专栏可以让大家在此交流学习心得、分享技术、共同进步。\[2\] 如果你对HyperMesh二次开发感兴趣,可以寻找这些教程专栏来获取更多的学习资源和指导。虽然这些教程可能存在一些没有覆盖到的内容和错误的地方,但是通过与他人的交流和探讨,可以更好地理解和应用HyperMesh二次开发技术。\[3\] #### 引用[.reference_title] - *1* *2* *3* [HyperMesh二次开发教程 - 前言](https://blog.csdn.net/buleskyline/article/details/122004956)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control_2,239^v3^insert_chatgpt"}} ] [.reference_item] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

小周原创

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值