Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
import*
#1
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 ...
Reply
#2
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
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply
#3
Thank you, your link is very useful information. Even if something is out of date, then most are still very useful!
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020