Next / Previous / Contents

27.2. How to name a widget instance

To give an instance name to a specific widget in your application, set that widget's name option to a string containing the name.

Here's an example of an instance name. Suppose you are creating several buttons in an application, and you want one of the buttons to have an instance name of panicButton. Your call to the constructor might look like this:

    self.panic = tk.Button(self, name='panicButton', text='Panic', ...)