博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Toplevel
阅读量:4558 次
发布时间:2019-06-08

本文共 1575 字,大约阅读时间需要 5 分钟。

option add *MessageInfo.title "Notice" widgetDefault

class MessageInfo {

    inherit itk::Toplevel

    constructor {args} {

        itk_component add dismiss {
            button $itk_interior.dismiss -text "Dismiss" -command "destroy $itk_component(hull)"
        }
        pack $itk_component(dismiss) -side bottom -pady 4

        itk_component add separator {

            frame $itk_interior.sep -height 2 -borderwidth 1 -relief sunken
        }
        pack $itk_component(separator) -side bottom -fill x -padx 4

        itk_component add icon {

            label $itk_interior.icon -bitmap info
        }
        pack $itk_component(icon) -side left -padx 8 -pady 8

        itk_component add infoFrame {

            frame $itk_interior.info
        }
        pack $itk_component(infoFrame) -side left -expand yes \
            -fill both -padx 4 -pady 4

        itk_component add message {

            label $itk_interior.mesg -width 20
        } {
            usual
            rename -text -message message Text
        }
        pack $itk_component(message) -expand yes -fill both

        eval itk_initialize $args

        after idle [code $this centerOnScreen]

    }

    protected method centerOnScreen {} {

        update idletasks
        set wd [winfo reqwidth $itk_component(hull)]
        set ht [winfo reqheight $itk_component(hull)]
        set x [expr ([winfo screenwidth $itk_component(hull)]-$wd)/2]
        set y [expr ([winfo screenheight $itk_component(hull)]-$ht)/2]
        wm geometry $itk_component(hull) +$x+$y
    }
}

usual MessageInfo {

    keep -background -cursor -foreground -font
    keep -activebackground -activeforeground -disabledforeground
    keep -highlightcolor -highlightthickness
}

#

# EXAMPLE:  Create a notice window:
#
MessageInfo .m -message "File not found:n/usr/local/bin/foo"

转载于:https://www.cnblogs.com/greencolor/archive/2011/06/12/2078791.html

你可能感兴趣的文章
挂载云硬盘后的分区、格式化与挂载
查看>>
android:shape的使用
查看>>
Android自定义UI
查看>>
spring boot整合quartz实现多个定时任务
查看>>
db powerdesign CDM、LDM、PDM、OOM的区别
查看>>
ISE和modelsim的配合
查看>>
通过用户模型,对数据库进行增删改查操作。
查看>>
群发邮件功能的完善
查看>>
gradle多项目构建及依赖
查看>>
linux, windows 文件传输的问题
查看>>
php:对象(object)数据类型实例详解
查看>>
关于java环境变量配置Javac命令无效问题
查看>>
常用的正则表达式
查看>>
Spring Boot使用@Async实现异步调用
查看>>
LeetCode 79. 单词搜索(Word Search)
查看>>
MySQL 多列索引优化小记
查看>>
J2SE核心开发实战(一)——认识J2SE
查看>>
gdbserver 远程调试问题:设置文件和so搜索路径
查看>>
SDK Build Tools revision (19.0.3) is too low for project Minimum required is 19.1.0
查看>>
推荐一个免费在线制作Banner的好地方
查看>>