2

I believe there is documentation available online, but for the sake of learning a little more about the interpreter, I am specifically wondering if I can use it to find out what is all available for the button class of the gpiozero module. I have tried things like, help(module) and dir(module), but I am not getting any descriptions of what is actually in the module. I am just starting out with all of this stuff so I hope that I have at least some brevity in my description (I apologise if I don't).

5

This is not a Pi specific question, but all the normal python commands work (at least as well as in any python shell) e.g.

import gpiozero
help(gpiozero)
dir(gpiozero)

To document the Button class help(gpiozero.Button)

The gpiozero Documentation is more helpful. https://gpiozero.readthedocs.io/en/stable/

| improve this answer | |
  • If you like, you can also enter interactive help mode by typing help(). Everything that you type therein shall be interpreted as if you enclosed it with help(""). – user96931 Mar 24 at 18:19
2

Using dir and help on the whole module or on specific classes or objects:

>>> from gpiozero import *
>>> dir(gpiozero)
>>> help(gpiozero)
>>> btn = Button(2)
>>> dir(btn) # or dir(Button)
>>> help(btn) # or help(Button)

Alternatively use the IPython shell and you can use e.g. Button? + <Enter> and get the help quicker.

| improve this answer | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.