Tkinter “module not callable” error.

Python

Hi. I am trying to write a python code with tkinter. This is my code:

import Tkinter as Tk

root = Tk()

And I am getting this error:

root = Tk()

TypeError: 'module' object is not callable

How to solve this?
 

1
Answers

Replies

Tk() is referred to as a module but not a method. Hence, you will need to call the Tk() method from the Tkinter module.


import Tkinter as tk


root = tk.Tk()

 
 

If you want to unleash your potential in this competitive field, please visit the Python course page for more information, where you can find the Python tutorials and Python frequently asked interview questions and answers as well.

 

This topic has been locked/unapproved. No replies allowed

Login to participate in this discussion.

Leave a reply

Before proceeding, please check your email for a verification link. If you did not receive the email, click here to request another.