欢迎来到尧图网

客户服务 关于我们

您的位置:首页 > 科技 > 名人名企 > Linux Gui 窗口对话和窗口操作

Linux Gui 窗口对话和窗口操作

2025/9/18 21:50:16 来源:https://blog.csdn.net/ocarvb/article/details/140637819  浏览:    关键词:Linux Gui 窗口对话和窗口操作

zenity

可以实现窗口对话

eg: 

zenity --error --width 300 --text "Permission denied. Cannot write to the file."
ChosenDate=$(zenity --calendar --text "Choose a date" --title "How-To Geek Rota" --day 1 --month 9 --year 2019);
echo $ChosenDate
Response=$(zenity --entry --text "Enter your search term" --title "Howe-To Geek" --entry-text=""); echo $Response

Python GUI Frameworks

Tkinter

优点:自带lib,不需要安装,轻量级,适合新手

缺点:gui风格老旧,组件较少

PyQt

优点:丰富的架构组件,文档和社区多,适合complex GUI projects

缺点: 需要license, 相比Tkinter学习较难

TCL/TK

linux command: wish test.tcl

destroy  .buttons
toplevel .buttons
wm title .buttons "Buttons"
set count 0
proc add_button {title command} {
  global count
  button .buttons.$count -text $title -command $command
  pack   .buttons.$count -side top -pady 1 -padx 1 -fill x
  incr count
}

#######################################
####                               ####
####     Change these lines to     ####
####     add your own buttons      ####
####                               ####
#######################################
add_button "Resize Main" { wm geometry . 464x650+0+0  }
add_button "Hello"       { puts "Hello there"         }
add_button "Goodbye"     { puts "Cheerio"             }
add_button "Exit"        { exit                       }

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com