Python——Menu控件

一、参数说明:  

  tearoff  :分窗,0为在原窗,1为点击分为两个窗口

  bg,fg  : 背景,前景

  borderwidth: 边框宽度

  font :  字体

  activebackgound   : 鼠标划过时背景,同样有activeforeground,activeborderwidth,

           disabledforeground

  cursor :当子菜单分离原窗时,鼠标在子菜单栏上的形状cursor="arrow""circle"

     "clock""cross""dotbox" "exchange""fleur""heart""heart""man"

     "mouse""pirate""plus"等图形

  postcommand :点击菜单的回调函数

  selectcolor  :     选中时背景色,add_checkbutton控件选中时,√的颜色

  takefocus  

  title        :当子菜单分离原窗时的标题

  type  

  relief   : 当子菜单分离原窗时的3D效果,relief=RAISED,SUNKEN,FLAT,RIDGE,SOLID,GROOVE

二、方法:    

  menu.add_cascade     :  添加子菜单(menu参数为子菜单对象)

  menu.add_command   :  添加命令(label参数为显示内容,command参数为响应函数)

  menu.add_separator   :  添加分隔线

  menu.add_checkbutton : 添加确认按钮,与add_radiobutton用法相同,效果为:

             点击时打钩(variable参数决定绑定变量)

  delete            :     删除

posted @ 2018-12-29 09:45  澄心元素  阅读(2184)  评论(0编辑  收藏  举报