Table of Contents
Often you want a simple widget to provide the user with the ability to add and remove other widgets dynamically. For example, you want to allow the user the ability to enter a near infinite set of angles.
This widget helps you do this by providing a means of counting the number of requests, generating signals indicating an ADD or REMOVE state.
The following is an example of how to use this widget,
def _onadd(event=None):
print "adding"
def _onremove(event=None):
print "removing"
def run_example():
"""Runs an example of this widget"""
global _addremove
root = Tkinter.Tk()
_addremove = GAddRemove(root, prefix="Count is: ")
objsignal.listen(_addremove, const.sigON_ADD,
None, _onadd)
objsignal.listen(_addremove, const.sigON_REMOVE,
None, _onremove)
_addremove.pack()
root.title("Demo - GAddRemove")
root.mainloop()
# start execution
run_example()
This generates the widget show in the figure below,
Example of the GAddRemove widget.
Basic widget to allow Add/Remove semantics.
The widget inherits attributes from GWidget defined in grail.widgets.gwidget.