0
Pycharm says the App class has not been set, but it doesn’t make any 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
What is the error message? And is there any way to verify the indentation of your code? 'Cause the question is wrong, but you can’t tell if it was wrong just when you put the code in the question or if it was wrong originally.
– Woss
I have already arranged the question, but in the code the indentation is correct. The error message I put in the question.
– Nicolas Medeiros Thiesen
Changes the class name to another, installed the module by the control s certinho?
– Estagiário