#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2004
    Posts
    6
    Rep Power
    0

    Noob With Widgets


    I am currently reading an e-book about python and its coming now to the part about widgets and stuff. I want to know if there is a website of some sort that can show and demenstrate all the different actions you can do with a widget. One in paticular i am having trouble with is clearing out an entry box. Like if the user typed something but then changed his/her mind they could click a button and then it would clear it out by deleting the text in the box. I can figure out how to add text but not how to clear the box. Any help is appreciated though a website for all widgets would help me in the future.

    Also, if you used to different programming styles, i am using a style like this...

    def close(event):
    sys.exit(0)

    button = Button(root)
    button.bind("<Button-1>")
    ...

    in other words, i am using "bind", for my buttons.
  2. #2
  3. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2004
    Posts
    6
    Rep Power
    0
    I found a website called pythonware.com, and so far its been a big help and i even got my program thing to work. Although, if you still know of some sources that would be great too. Thanks.
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2004
    Posts
    84
    Rep Power
    11
    I will assume you're using Tkinter, and say it is quite easy to clear the contents of an Entry or Text widget. Here is a quick example:

    Code:
    #clear an Entry widget
    entry_widget.delete(0,END)
    #clear a Text widget
    text_widget.delete(1.0,END)
    I'm not sure if you need to know how to set up a button to clear the widget, or just what method should be called to do it. If I didn't hit the nail on the head, let me know

IMN logo majestic logo threadwatch logo seochat tools logo