About 9,910,000 results
Open links in new tab
  1. tkinter - Programming in Python: Getting "name 'Tk' is not defined ...

    I believe you are using python 3 or higher version, and the error is NameError: name 'tk' is not defined which is getting at root = tk(). Please change that to root = Tk() and you will be good to go.

  2. python - NameError: name 'Tk' is not defined - Stack Overflow

    Jul 24, 2014 · I am attempting to use Tkinter for the first time on my computer, and I am getting the error in the title, "NameError: name 'Tk' is not defined", citing the "line root = Tk()". I have not been able to get Tkinter to work in any form. I am currently on a macbook pro using python 2.7.5.

  3. Python tkinter: NameError: name 'tk' is not defined

    Sep 22, 2021 · By doing import tkinter as tk, you can use and read everything tkinter prefixing it with tk. which is both easy to read and to type.

  4. tk is not defined - Python Forum

    Aug 3, 2023 · The code below works when I execute it with idle or in CLI but when I execute it with vscode, I have the message "NameError: name 'Tk' is not defined" from tkinter import * fenetre = Tk()

  5. NameError: name 'tk' is not defined : r/learnpython - Reddit

    May 25, 2021 · The "import x as y" lets you rename the module you're importing. "tk" is often used because it's short, but it can be just about anything you want. import tkinter as ReallyBigCow root = ReallyBigCow.Tk() # Same result, different alias for the module. If you use import *, it's different:

  6. NameError: name is not defined in Python [with 4+ Examples] - Python

    Feb 19, 2024 · Before using a variable or calling a function, check if it exists to avoid NameError: name is not defined in Python. We can use the in-operator or hasattr() function in Python to determine if a name is defined.

  7. I keep getting the "name is not defined" error in Python when I …

    Feb 15, 2020 · cur.execute("INSERT INTO user (ID, Name, Age, Email, Town) VALUES (?, ?, ?, ?, ?)", (uid, str(nme), str(age), str(eml), str(twn))) and here is the error i get Exception has occurred: NameError name 'uid' is not defined the thing is that i have already defined all the names in a function.

  8. python - NameError: name Tk is not defined [SOLVED] | DaniWeb

    Nov 27, 2013 · from tkinter import * root = Tk() calc = Frame(root) calc.grid() root.title("Calculator") text_box = Entry(calc, justify=RIGHT) text_box.grid(row = 0, column = 0, columnspan = 3, pady = 5) text_box.insert(0, "0") root.mainloop()

  9. How to Fix the NameError: name 'Tk' is not defined in Your

    Jan 27, 2025 · Encountering the "NameError: name 'Tk' is not defined" error in your Tkinter code can be frustrating. This guide explains why this error occurs and how to re...

  10. Tkinter: NameError: name 'tk' is not defined - Stack Overflow

    Oct 8, 2015 · "C:/Users/Gerard/Dropbox/Master_Thesis_Gerard_Pujol/Python_Tryouts/creting_simpleGUI.py", line 11, in root=tk() NameError: name 'tk' is not defined. After that I changed my code, so I used something like that: import tkinter as tk root = tk() root.title("Simple GUI") root.geometry("200x100") root.mainloop() Now, the error is the following:

Refresh