How can I find out the file path and correct script containing a particular function or class of a module?
Example: Say I want to take a look at the tkinter source code for tkinter.Button()
.
I found where the __init__.py
file is located for tkinter using:
>>>import tkinter
>>>tkinter.__file__
'C:\\Users\\Simon\\AppData\\Local\\Programs\\Python\\Python36-32\\lib\\tkinter\\__init__.py'
I searched through that folder but was unable to locate any function or class named Button
. My guess that it is contained inside the run-times and not a .py
file but I am not definite and want to be sure of this.
I could not find anything useful in the Python documentation special attributes either.
Any suggestions are welcome but please note that this post is not set only on the tkinter module but most packages or modules, tkinter just being an example.