ASPN ActiveState Programmer Network  
ActiveState, a division of Sophos
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups
Submit Recipe
My Recipes

All Recipes
All Cookbooks


View by Category

Title: Get widget info
Submitter: peter berger (other recipes)
Last Updated: 2001/09/12
Version no: 1.0
Category: Development, Debugging

 

5 stars 1 vote(s)


Approved

Description:

This script creates a window with a button and text widget. You press the button, drag the cursor over the widget in question then release the mouse button. The text widget then displays all of the configuration options for the widget you released the button over.

Source: Text Source

toplevel .find

grid [text .find.info -yscrollcommand {.find.scr set} -width 40] -row 0 -column 0 -sticky ns
grid rowconfigure .find 0 -weight 1
grid [scrollbar .find.scr -command {.find.info yview}] -row 0 -column 1 -sticky ns
grid [button .find.find -text "find"] -row 1 -column 0 -columnspan 2
bind .find.find <Button> {
   grab -global .find.find
}
wm geometry .find 290x345

bind .find.find <ButtonRelease> {
   grab release [grab current]
   set what [winfo containing %X %Y]
   if {$what != ""} {
      .find.info delete 1.0 end
      .find.info insert end "$what\n"
      foreach a [$what config] {
         .find.info insert end "\t[lindex $a 0] [$what cget [lindex $a 0]]\n"
      }
   } else {
      .find.info delete 1.0 end
      .find.info insert 1.0 NULL
   }
   update
}

The license for this recipe is available here.

Discussion:

nice for debugging



Add comment

No comments.



Highest rated recipes:

1. With busy cursor

2. WSCP - showServerStatus

3. Check creditcard numbers ...

4. Simplified mega-widiget ...

5. Inline GIF image into ...

6. Multi-character split

7. LCD Number Display

8. Supporting mouse wheel ...

9. Get widget info

10. A minimal debugger




Privacy Policy | Email Opt-out | Feedback | Syndication
© 2006 ActiveState Software Inc. All rights reserved.