Advertisement
systems_architect

TCL/TK Sample App

Apr 4th, 2018
479
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
TCL 0.99 KB | None | 0 0
  1. #! /usr/bin/tclsh
  2. package require Tk
  3.  
  4. # Create the main menu bar with a Help-About entry
  5. menu .menubar
  6. menu .menubar.help -tearoff 0
  7. .menubar add cascade -label Help -menu .menubar.help -underline 0
  8. .menubar.help add command -label {About} \
  9.     -accelerator F2 -underline 0 -command showAbout
  10.  
  11. #  Define a procedure - an action for Help-About
  12. proc showAbout {} {
  13.     tk_messageBox -message "Application\nVersion 0.1\n\nBy Marc Carson" \
  14.         -title {About Application} \
  15.         -detail {Thank you for trying it out!}
  16. }
  17.  
  18. # Configure the main window
  19. wm title . {Application}
  20. . configure -menu .menubar -width 300 -height 150
  21. bind . {<Key F1>} {showAbout}
  22.  
  23. set cmda [list exec thunar "/home/user/Downloads"]
  24. set cmdb [list exec thunar "/home/user/Documents"]
  25.  
  26. button .m.a -text "Open Downloads Folder" \
  27.     -command $cmda
  28. pack   .m.a -side top -pady 1 -padx 1 -fill x
  29.  
  30. button .m.b -text "Open Documents Folder" \
  31.     -command $cmdb
  32. pack   .m.b -side top -pady 1 -padx 1 -fill x
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement