Why do i get this error in tkinter - Python

0 votes
This is my code:

from tkinter import *

root = Tk()

hw = Label(root, text="Hello World!")

hw.pack()

root.mainloop()

This is the error i get:

Traceback (most recent call last):
  File "/Users/lorisruegg/Documents/Python/tkinter.py", line 1, in <module>
    from tkinter import *
  File "/Users/lorisruegg/Documents/Python/tkinter.py", line 3, in <module>
    root = Tk()
NameError: name 'Tk' is not defined
Oct 10 in Python by LogizTV
• 120 points
3 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In Python

0 votes
1 answer

In NumPy how do I get the maximum of subsets? Python

You can use np.maximum.reduceat: >>> _, idx = np.unique(g, ...READ MORE

answered Nov 9, 2018 in Python by Nymeria
• 3,540 points
637 views
0 votes
1 answer

Why am I getting a error when I am printing two different data types in python?

different data type is being used. that ...READ MORE

answered Mar 6, 2019 in Python by Mohammad
• 3,230 points
246 views
0 votes
1 answer

How do I get a random number with a float range in python?

Use random.uniform(a, b): Returns a random floating point ...READ MORE

answered May 27, 2019 in Python by Kiran
242 views
0 votes
1 answer

What to do when I get and error saying python not recognized as internal or external command?

You need to set up the path ...READ MORE

answered May 28, 2019 in Python by Fata
• 1,050 points
807 views
+1 vote
4 answers

How do i resolve the "unexpected indent" error in python?

Look for the whitespaces which are not ...READ MORE

answered Aug 2, 2019 in Python by Mohammad
• 3,230 points
67,136 views
0 votes
2 answers
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 7, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 2,482 views
0 votes
1 answer