When I click on this button I wish to Enable a button (DeleteButton) that again has been disabled by default, but I get an error message that 'DeleteButton' hasn't been defined.
When I click on this button I wish to Enable a button (DeleteButton)
that again has been disabled by default, but I get an error message that
'DeleteButton' hasn't been defined.
That will only work if DeleteButton is global. But what you probably want
to do is save a reference to it in self when you create the button, and then
use self.DeleteButton...
···
--
Robin Dunn
Software Craftsman
robin@AllDunn.com Java give you jitters? http://wxPython.org Relax with wxPython!
if you don't make the button an attribute of YourClass, then it goes out of
scope at the end of __init__, so Python looks in the global namespace and
can't find a global variable named DeleteButton. By attaching it to
YourClass, you maintain a reference to it (it becomes part of the namespace
of the instance of YourClass)
if you don't make the button an attribute of YourClass, then it goes out of scope at the end of __init__, so Python looks in the global namespace and
can't find a global variable named DeleteButton. By attaching it to YourClass, you maintain a reference to it (it becomes part of the namespace of the instance of YourClass)