You can find out where a module is located,
and built_in docs with something like:
import importlib
def get_module_info(module):
mod = importlib.import_module(module)
print('Module location: {}'.format(mod.__file__))
mdoc = mod.__doc__
print(mdoc)
get_module_info('tkinter')
results:
Output:
Module location: C:\Python364\lib\tkinter\__init__.py
Wrapper functions for Tcl/Tk.
Tkinter provides classes which allow the display, positioning and
control of widgets. Toplevel widgets are Tk and Toplevel. Other
widgets are Frame, Label, Entry, Text, Canvas, Button, Radiobutton,
Checkbutton, Scale, Listbox, Scrollbar, OptionMenu, Spinbox
LabelFrame and PanedWindow.
Properties of the widgets are specified with keyword arguments.
Keyword arguments have the same name as the corresponding resource
under Tk.
Widgets are positioned with one of the geometry managers Place, Pack
or Grid. These managers can be called with methods place, pack, grid
available in every Widget.
Actions are bound to events by resources (e.g. keyword argument
command) or with the method bind.
Example (Hello, World):
import tkinter
from tkinter.constants import *
tk = tkinter.Tk()
frame = tkinter.Frame(tk, relief=RIDGE, borderwidth=2)
frame.pack(fill=BOTH,expand=1)
label = tkinter.Label(frame, text="Hello, World")
label.pack(fill=X, expand=1)
button = tkinter.Button(frame,text="Exit",command=tk.destroy)
button.pack(side=BOTTOM)
tk.mainloop()
but there is no 'dis-interpreter'
there is however dis (must be imported) for cpython byte code,
see:
https://docs.python.org/3/library/dis.html
example:
import importlib
import dis
def disassemble_pcode(module):
mod = importlib.import_module(module)
print(dis.dis(mod))
disassemble_pcode('tkinter')
partial results:
Output:
Disassembly of BaseWidget:
Disassembly of __init__:
2283 0 LOAD_FAST 4 (kw)
2 POP_JUMP_IF_FALSE 16
2284 4 LOAD_GLOBAL 0 (_cnfmerge)
6 LOAD_FAST 3 (cnf)
8 LOAD_FAST 4 (kw)
10 BUILD_TUPLE 2
12 CALL_FUNCTION 1
14 STORE_FAST 3 (cnf)
2285 >> 16 LOAD_FAST 2 (widgetName)
18 LOAD_FAST 0 (self)
20 STORE_ATTR 1 (widgetName)
2286 22 LOAD_GLOBAL 2 (BaseWidget)
24 LOAD_ATTR 3 (_setup)
26 LOAD_FAST 0 (self)
28 LOAD_FAST 1 (master)
30 LOAD_FAST 3 (cnf)
32 CALL_FUNCTION 3
34 POP_TOP