lundi 2 mars 2020

Python Dir function returning different results

I'm trying to get the value of WxPython checkboxes. When I run the following command inside my Class:

print(self)
a = dir(self)
print(a)

#result
<__main__.Window object at 0x03B02670>
['AcceleratorTable', 'AcceptsFocus', etc...
 'm_staticText3', 'm_staticText31', 'm_staticText311', 'm_staticText3111', 'm_staticText3112', 'm_staticText31121', 'm_staticline1', 'm_staticline3']

My checkboxes are part of the returned result. But when I substitute the 'self' for the class 'Window', the checkbox attributes are missing!

print(Window)
a = dir(Window)
print(a)

#result
<class '__main__.Window'>
['AcceleratorTable', 'AcceptsFocus', etc..,
 'WindowVariant', '__bool__', '__class__', '__del__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__nonzero__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__']

It looks the same, but my checkboxes are not returned! What's going on here?




Aucun commentaire:

Enregistrer un commentaire