1. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

[Python] from tkinter import * used; unable to detect undefined names in Spyder2 IDE

Discussão em 'Python' iniciado por Stack, Outubro 1, 2024 às 01:12.

  1. Stack

    Stack Membro Participativo

    I installed Anaconda in my MacBookPro (OSX 10.11.4 El Capitan) and try to run the following program of Python3.5.1 using Spyder2;

    from tkinter import *
    import sys
    win = Tk()
    button = Button(win, text='Push this Button!', command=exit)
    button.pack()
    mainloop()


    However, Spyder2 tells me "from tkinter import * used; unable to detect undefined names", I cannot run it under Spyder2. However, after saving it with the name of "Sample.py" and run it in the Terminal, I can run it successfully. I suppose this error might be caused unresolved error in linker. Can you help me? I also encountered this problem when I installed Anaconda in Windows10.

    Thank you Bryan. I tried the following code in Spyder2;

    import tkinter as tk
    import sys
    win=tk.Tk()
    button=tk.Button(win,text="Goodbye",command=exit)
    button.pack()
    tk.mainloop()


    Then, it worked. However, still I do not understand why the original one did not work under Spyder 2, while it nicely worked under Bash.

    Continue reading...

Compartilhe esta Página