一、參數說明:
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 : 刪除