osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

help with tkinter


Doubly agreed. Avoid import * as it makes the code a nightmare to reason
about later amongst other things

On Fri, 9 Aug 2019 at 20:02, Peter J. Holzer <hjp-python at hjp.at> wrote:

> On 2019-08-09 12:43:45 -0600, Michael Torrie wrote:
> > On 8/9/19 4:52 AM, Peter J. Holzer wrote:
> > > You didn't import 'tkinter', you imported all symbols ('*') from
> > > tkinter. So, since you imported colorchooser, you can call
> > > colorchooser.askcolor() (not tkinter.colorchooser.askcolor())
> >
> > The better thing to do is remove the import * line and just "import
> > tkinter" and then make sure all your calls to tkinter objects are fully
> > qualified with the "tkinter." part like you've already been doing.
>
> Agreed.
>
>         hp
>
> --
>    _  | Peter J. Holzer    | we build much bigger, better disasters now
> |_|_) |                    | because we have much more sophisticated
> | |   | hjp at hjp.at         | management tools.
> __/   | http://www.hjp.at/ | -- Ross Anderson <https://www.edge.org/>
> --
> https://mail.python.org/mailman/listinfo/python-list
>