Advertisement
Guest User

Untitled

a guest
Jun 23rd, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. proc get_widgets {{start_path .}} {
  2. global widgets
  3.  
  4. if {[string equal $start_path .]} {
  5. catch {unset widgets}
  6. }
  7.  
  8. set ws [winfo children $start_path]
  9. add_widget $ws
  10. foreach w $ws {
  11. add_widget $w
  12. get_widgets $w
  13. }
  14. }
  15.  
  16. proc add_widget {w} {
  17. if {[winfo exist $w]} {
  18. upvar #0 widgets([winfo class $w]) type
  19. lappend type $w
  20. }
  21. }
  22.  
  23. proc new_config {cl ncfg val {map "*"}} {
  24. global widgets
  25. get_widgets
  26. if {![info exist widgets($cl)]} {
  27. return
  28. }
  29. foreach widg $widgets($cl) {
  30. if {[string match $map $widg]} {
  31. $widg configure $ncfg $val
  32. option add ${map}*[lindex [$widg configure $ncfg] 2] $val
  33. }
  34. }
  35. }
  36.  
  37. new_config Button -background green *tastebin*
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement