importing

Terry Reedy tjreedy at udel.edu
Mon Mar 7 17:21:49 EST 2016


On 3/7/2016 12:23 PM, Tony van der Hoff wrote:

> However, more generally, how am I supposed to know that a module is part
> of a package, and needs a "magic" stanza to get a module loaded?

The doc for a package usually mentions the submodules it contains, as in
https://docs.python.org/3/library/tkinter.html#tkinter-modules

The doc for a submodule has the package name in its title line.

25.4. tkinter.scrolledtext — Scrolled Text Widget
8.4. collections.abc — Abstract Base Classes for Containers

And yes, tkinter docs need considerable work.  That is why there are 
several external resources list in the intro.  I mostly use #3 Tkinter 
reference (not perfect) supplements by #2, #4, and #5.  Not mentioned 
there are the docstrings (also not perfect), accessible via interactive 
help.

 >>> import tkinter as tk
 >>> help(tk.Button.configure)
Help on function configure in module tkinter:

configure(self, cnf=None, **kw)
     Configure resources of a widget.

     The values for resources are specified as keyword
     arguments. To get an overview about
     the allowed keyword arguments call the method keys.

-- 
Terry Jan Reedy





More information about the Python-list mailing list