Python Forum

Full Version: import*
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello!
An expression (from tkinter import *) is often used. In order not to use an asterisk, you need to know what specifically to import. How to find out what your program uses from tkinter so that it can be imported? For example - from tkinter import (Tk, Button, Label, StringVar, Entry, END ......) Not only widgets need to be imported, but also attributes for them, maybe something else ...
You are the one writing the program, you know what you want to use and import it. Of course you need to reference the documentation for available classes, methods, functions, etc. to know what is available to you. Although rather old (keep that in mind) I found this tutorial very useful: https://anzeljg.github.io/rin2/book2/240...index.html

IMHO, better import tkinter as tk and later on in the code fully refernce what you use e.g. tk.Button

Note that you may need to import sub-packages like ttk separately
Thank you, your link is very useful information. Even if something is out of date, then most are still very useful!