I can not execute the code because PyCharm says that the App class was not created

0

PyCharm says that the App class has not been defined, but that does not make sense since I created the App class.

from tkinter import *
class App:
    def __init__(self,master):
        frame = Frame(master)
        frame.pack()
        Label(frame,text='Graus C').grid(row=0)
        self.c_var = DoubleVar()
        Entry(frame, textvariable=self.c_var).grid(row=0,column=1)
        Label(frame,text='Graus F').grid(row=1)
        self.result_var = DoubleVar()
        Label(frame,textvariable=self.result_var).grid(row=1,column=1)
        button = Button(frame,text='Convert',command=self.convert).grid(row=2,columnspan=2)

    def convert(self):
        print('No implemented')

root = Tk()
root.wm_title('Conversor de graus C para graus F')
app = App(root)
root.mainloop()

Error:

Traceback (most recent call last):
  File "D:\PyCharm Community Edition 2018.1.4\helpers\pydev\pydev_run_in_console.py", line 52, in run_file
    pydev_imports.execfile(file, globals, locals)  # execute the script
  File "D:\PyCharm Community Edition 2018.1.4\helpers\pydev\_pydev_imps\_pydev_execfile.py", line 18, in execfile
    exec(compile(contents+"\n", file, 'exec'), glob, loc)
  File "C:/Users/nicol/PycharmProjects/Projetos/converter.py", line 2, in <module>
    class App:
  File "C:/Users/nicol/PycharmProjects/Projetos/converter.py", line 19, in App
    app = App(root)
NameError: name 'App' is not defined
    
asked by anonymous 27.06.2018 / 04:41

0 answers