Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #104233
| From | Mark Lawrence <breamoreboy@yahoo.co.uk> |
|---|---|
| Newsgroups | comp.lang.python |
| Subject | Re: importing |
| Date | 2016-03-07 17:30 +0000 |
| Message-ID | <mailman.34.1457372105.10335.python-list@python.org> (permalink) |
| References | <56DDA44B.7040405@vanderhoff.org> <CAPTjJmpAaefgSA+YKm45A4ucuEgjPgL+XmugS22oFB_1ZccGxQ@mail.gmail.com> <56DDB91D.3020006@vanderhoff.org> |
On 07/03/2016 17:23, Tony van der Hoff wrote: > Thanks to all who replied to my cry for help; I understand it better > now. But: > > On 07/03/16 16:08, Chris Angelico wrote: >> >> The documentation should tell you what you need to import to make >> something work. In this case, I would guess that "import >> tkinter.messagebox" or "from tkinter import messagebox" would be the >> recommended way to use this module. > > Well, I found the tkinter documentation to be sparse in the extreme > (https://docs.python.org/release/3.1.3/library/tkinter.html), and it > certainly doesn't go into that sort of detail. > > 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? > > Cheers, It all depends on whether or not there is an __init__.py file in the directory, see e.g. http://pythoncentral.io/how-to-create-a-python-package/ -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: importing Mark Lawrence <breamoreboy@yahoo.co.uk> - 2016-03-07 17:30 +0000
csiph-web