dialog(窗體編程)的用法

 

dialog (窗體編程)
 
--print-maxsize  #顯示窗體支持的最大是多少
--backtitle          #背景標題 
--begin yx          #指定窗體的正座標
 --no-shadow     #不顯示窗體的陰影
 --defaultno        #修改指定的默認鍵
 --default-inem   #定義默認的單選項目是
--insecure          #輸入部件的密碼時,明文顯示不安全,使用星號來代表每個字符
--msgbox          #顯示信息
--nocancel        #不能選擇取消
--flselect           #讓用戶自定義選擇
--gauge           #進度條,顯示進度
--passwordbox    #密碼框
 --menu                #選擇菜單
--textbox              #顯示某一個文件下的內容
--inputbox           #顯示輸入框
--pause              #顯示倒計時
--nook                #不顯示ok鍵
--timebox          #提供一個窗口選擇小時,分鐘秒
--extra-button   #添加按鈕
 --extra-label   string  #添加額外的標籤
--exit-label string       #定義退出的標籤串
--form                        #允許您建立一個帶標籤的文本字段,並要求填寫  
用腳本測試用戶的操作
#!/bin/bash 
dialog –msgbox “This is test” 10 20 
 x=$? 
 if [ “$x” –eq 0 ];then 
 echo “you press enter” 
 elif [ “$x” –eq 255 ];then 
 echo “you press Esc” 
 else  
 echo “you press ctrl+c“  
fi   
Dialog --backtitle "This a test" --title "delete a file" --msgbox "Do you want delete a file?" 10 25
dialog --title "daojishi" --pause last ten 10 30 100  (100秒倒計時) 

dialog  --title "About name" --inputbox "input your name" 8 30(顯示的高度)
--menu 選擇菜單 
dialog --title “pick a choice” --menu “Choose one” 12 35 3 1 “Display the disk usage” 2 “Display the meminfo”3 “Exit”
--menu 文本高寬 菜單高 1+內容 2+內容...

 dialog --title "pick one file" --fselect /root 7 40

 Dialog --gauge "test" 10 30 30 (--gauage是顯示進度條的,最後一個30是30%)

--passwordbox 密碼框 --insecure 密碼顯示爲* 
dialog  --passwordbox text height width [init] 
dialog --title "Password"  --insecure --passwordbox "Please give a password for the new user:" 10 35

Dialog --title "the fstab" --exit-lable "quit" --textbox /etc/fstab 20 40更改退出菜單爲quit

Dialog --colors --title "Delete" --ok-lable "Submit" --msgbox "\Z1/delete a file\Zn" 7 25 

--colors 定義顏色  --oklable 更換ok爲Submit Z1爲紅色


 --inputbox 顯示輸入框,並把輸入的信息賦值給name

--gauge 進度條,顯示進度
dialog --gauge text height width[<percent>]

用腳本實現動態進度條,使拷貝文件時以進度條顯示進度

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章