I am experimenting with using wxPython
and using sizer in a small experimental sketch. I don’t think
the sizer is my issue (?).
One of the things I do not
understanding is why I can not change the panel background colour
in a button click event handler? I
thought that: panel.SetBackgroundColour(“Blue”) would be
ok.
However, if using this in the button
event function, I get an attribute error:
AttributeError:
‘MyFrame’ object has no attribute ‘panel’
In the MyFrame init code I can and do
assign the panel to a back ground colour , Blue in this case.
In using the button event function I
added this code:
panel.SetBackgroundColour(“Blue”)
gives the error as well as self.panel.SetBackgroundColour(“Blue”).
However in the init section of code I
assign Z=panel. The in the button event function I use:
self.z.SetBackgroundColour(“Red”)
and this changes the background color of the panel.
So I am confused (as usual) on this
behavior.
If someone can help explain what I am
doing wrong that would be a huge help!