Giter VIP home page Giter VIP logo

Comments (2)

rdbende avatar rdbende commented on May 25, 2024

Well, the thing is that I really hate star imports in Python. It's almost always a bad and lazy thing to do. It bloats the global namespace, and makes the code less readable.

__all__: list = [] # Making star imports impossible. Is it illegal?

I deliberately made such imports impossible, to prevent people from making such bad things while using Tukaan. I wouldn't recommend anyone to do star imports, especially with Tkinter, as you mentioned.
In tkinter you have two different widget sets, and if you do

from tkinter import *
from tkinter.ttk import *

then how do you know, which widget comes from which widget set? Therefore I really recommend everyone to do this instead, where you can use both plain tk and themed widgets.

import tkinter as tk  # So it's short, and you don't have to type too much
from tkinter import ttk  # Get themed widgets as well

window = tk.Tk()

non_themed_btn = tk.Button(window)
themed_btn = ttk.Button(window)

If you know the Zen of Python you know, that Explicit is better than implicit and that readability counts, and star imports provide neither of those.
I'm currently on a touch device, so explaining this is kinda a pain for me, but here's a great post that explains it.
Anyways I'd stick with import tukaan and from tukaan import SomeThing, it isn't that exhaustive.

from tukaan.

Moosems avatar Moosems commented on May 25, 2024

@rdbende Understood and noted. Thanks for the advice by the way

from tukaan.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.