[Python] Tkinter -- "window is not defined"

Discussão em 'Python' iniciado por Stack, Junho 24, 2025.

  1. Stack

    Stack Membro Participativo

    I am a newbie in Python GUI's so I am using an online tutorial. When I run the following code, I get an error saying 'window' is not defined.

    I am using a Windows PC with Windows 7 and Python 3.3 installed.

    from tkinter import *

    window.title("Test Window")

    window.geometry('300x300')

    window.wm_iconbitmap('Generals.ico')
    # Generals.ico is a filename for the window icon

    lbl = tkinter.Label(window, text='Label')
    lbl.pack()

    window.mainloop()

    Continue reading...

Compartilhe esta Página