Linux GUI脚本zenity
来源:互联网 发布:程序员很难找女朋友吗 编辑:程序博客网 时间:2024/06/05 08:24
zentiy可以帮助你使用脚本创建常用的gtk+对话框。
1、使用日历控件:
szDate=$(zenity --calendar --text "Pick a day" --title "Medical Leave" --day 13 --month 5
--year 2010); echo $szDate
--year 2010); echo $szDate
2、创建一个Entry对话框:
szAnswer=$(zenity --entry --text "where are you?" --entry-text "at home"); echo $szAnswer
3、创建一个错误对话框:
zenity --error --text "Installation failed! "
4、创建一个Info对话框:
zenity --info --text "Join us at irc.freenode.net #lbe."
5、创建一个文件选择对话框:
szSavePath=$(zenity --file-selection --save --confirm-overwrite);echo $szSavePath
6、创建一个通知对话框:
zenity --notification --window-icon=update.png --text "Please update your system."
7、创建一个进度对话框:
gksudo lsof | tee >(zenity --progress --pulsate) >lsof.txt
8、创建一个question对话框:
zenity --question --text "Are you sure you want to shutdown?"; echo $?
9、创建一个警告对话框:
zenity --warning --text "This will kill, are you sure?";echo $?
10、创建一个滑动scale对话框:
ans=$(zenity --scale --text "pick a number" --min-value=2 --max-value=100 --value=2
--step 2);echo $ans
--step 2);echo $ans
11、创建一个文本信息对话框:
gksudo lsof | zenity --text-info --width 530
12、创建一个列表对话框:
radiolist:
ans=$(zenity --list --text "Is linux.byexamples.com helpful?" --radiolist --column "Pick"
--column "Opinion" TRUE Amazing FALSE Average FALSE "Difficult to follow" FALSE "Not helpful");
echo $ans
--column "Opinion" TRUE Amazing FALSE Average FALSE "Difficult to follow" FALSE "Not helpful");
echo $ans
checklist:
ans=$(zenity --list --text "How linux.byexamples can be improved?" --checklist
--column "Pick" --column "options" TRUE "More pictures" TRUE "More complete post" FALSE "
Includes Installation guidelines" FALSE "Create a forum for question queries"
--separator=":"); echo $ans
--column "Pick" --column "options" TRUE "More pictures" TRUE "More complete post" FALSE "
Includes Installation guidelines" FALSE "Create a forum for question queries"
--separator=":"); echo $ans
一个linux elementary主题的安装脚本的例子:
- #!/bin/bash
- zenity --info --text "This is an installation file for elementary theme.\nIt will download latest packages and install them\nand aswell apply the elementary theme.\n\nVisit us at: www.elementary-project.com\nIRC: #elementary on irc.freenode.org\n\nBest Regards\nElementary Team"
- OPTIONS=$(zenity --list --width=370 --height=350 --title="elementary installation" --text="Please select elementary components you\nwould like to have installed." --checklist --column "Option" --column "Description" TRUE "Elementary Theme" TRUE "Elementary Icons" TRUE "GTK Murrine Engine")
- (
- gksudo "add-apt-repository ppa:elementaryart/ppa"
- gksudo "apt-get update"
- DOIT=$(echo $OPTIONS | grep "Engine")
- if [ -n "$DOIT" ] ; then
- gksudo apt-get install gtk2-engines-murrine
- fi
- DOIT=$(echo $OPTIONS | grep "Theme")
- if [ -n "$DOIT" ] ; then
- gksudo apt-get install elementary-theme
- fi
- DOIT=$(echo $OPTIONS | grep "Icons")
- if [ -n "$DOIT" ] ; then
- gksudo apt-get install elementary-icon-theme
- fi
- gconftool-2 --type string --set /desktop/gnome/interface/gtk_theme "elementary"
- gconftool-2 --type string --set /apps/metacity/general/theme "elementary"
- gconftool-2 --type string --set /desktop/gnome/interface/icon_theme "elementary"
- ) | zenity --progress --width 370 --height 180 --pulsate --title "Installing selected components" --text "Installing...\nBe patient please." --auto-close
- zenity --info --text "elementary theme successfully installed!\n\nScript made by: Nookie^\n\nVisit: elementary-project.com\nIRC: #elementary on irc.freenode.org"
- Linux GUI脚本zenity
- zenity
- zenity 脚本设置系统日期和时间
- 图形化脚本2.zenity工具
- linux下gtk+图形界面--zenity的使用练习
- Unity3D-- GUI 时钟脚本
- Unity3d GUI 时钟脚本
- 脚本启动JD-GUI
- linux GUI
- linux gui
- linux GUI
- Zenity 中文手册
- GUI常用的脚本类
- 基于zenity的“运行”对话框
- A complete zenity dialog examples
- zenity 实现一个滚动条
- zenity 实现一个滚动条
- A complete zenity dialog examples
- 计算机图形学 几何变换代码
- 菜鸟初学Android开发:Android Snake工程加载超时问题
- Context3D类中的configureBackBuffer方法(设置渲染缓冲区的视口尺寸和其他属性)
- java常见错误
- Exchange 2010简单三步配置外网邮件收发
- Linux GUI脚本zenity
- Sipdroid注册(三)-注册返回结果的监听
- 计算机图形学 复合变换矩阵
- ExtJS4.0学习心得
- oracle 视图 序列 同义词
- 用URL请求做文件上传
- Linux学习笔记一
- linux下查看文件编码及修改编码
- Weak Alias