0

urgent!!! import python

i want to import tkinter as tk but i need to do this to: from tkinter import * it gives me an error every time i go: from tkinter import * as tk does any body know why? the error an invalid code also, you can ignore the tkinter thing, that is just what i am working with right now

20th Oct 2017, 12:36 AM
vortetty
vortetty - avatar
4 Réponses
+ 10
Python doesn't support * as meaning "select everything". If you want to import the entire module, simply write: import tkinter as tk
20th Oct 2017, 12:54 AM
Tamra
Tamra - avatar
+ 1
I am using the official python processer, but asking questions here
20th Oct 2017, 1:20 PM
vortetty
vortetty - avatar
+ 1
Also, thank you for the answer, that helped alot
20th Oct 2017, 1:22 PM
vortetty
vortetty - avatar
0
wait up... in where you are getting errors exactly??? in sololearn?????? @ Arick House carefully understand this... python perfectly supports * and when u r doing import tkinter as tk it means in your code you are gonna replace the tkinter word with tk... but u said u wanna do from tkinter import * it means you dont have to use the tkinter module... the in-build methods are imported... u dont have to do this... ## window=tkinter.Tk() you can easily access Tk() method window=Tk() now this thing--> from tkinter import * as tk it doesnt mean something... * is not a module or method that u are going to replace with tk * means it imported all built-ins at once.. just use them... @@@@ and SL supports * perfectly... @@@@@ and python also supports * perfectly
20th Oct 2017, 4:19 AM
sayan chandra
sayan chandra - avatar