tuxdevo

Untitled

Jun 2nd, 2017
342
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/usr/bin/wish
  2. wm title . "TTk"
  3. wm minsize . 400 300
  4. set winWidth 800
  5. set winHeight 600
  6. set winX [expr ([winfo screenwidth .]-$winWidth)/2]
  7. set winY [expr ([winfo screenheight .]-$winHeight)/2]
  8. wm geometry . ${winWidth}x${winHeight}+${winX}+${winY}
  9.  
  10. ttk::style theme use clam
  11.  
  12. grid columnconfigure . 0 -weight 1
  13. grid rowconfigure . 0 -weight 1
  14. grid columnconfigure . 1 -weight 0
  15. grid rowconfigure . 1 -weight 0
  16.  
  17. text .text -relief sunken -background blue -foreground white \
  18.     -font [font create -family "PT Mono" -size 16 -weight normal] -blockcursor true \
  19.     -yscrollcommand {.scrv set}
  20. grid .text -row 0 -column 0 -sticky NESW
  21.  
  22. ttk::scrollbar .scrv -command {.text yview}
  23. grid .scrv -row 0 -column 1 -sticky NES
  24.  
  25. ttk::frame .f_button
  26. grid .f_button -row 1 -column 0 -sticky ESW
  27.  
  28. ttk::button .f_button.b_exit -text "Close" -command exit
  29. pack .f_button.b_exit -side left
  30.  
  31. ttk::sizegrip .sz
  32. grid .sz -column 1 -row 1 -sticky NES
  33.  
  34. .text insert 0.0 [read [open "ttk_test"]]
  35.  
  36. focus .f_button.b_exit
  37. bind . <KeyPress-Escape> exit
RAW Paste Data