I keep getting the following error on a piece of python code:
Traceback (most recent call last):
File"..."...in <module>
app = App(root)
TypeError: object.__new__() takes no parameters
Here is the code it is referring to:
from tkinter import *
from ScaleAndOffsetConverter import *
class App():
def __init_(self, master):
self.c_var = DoubleVar()
self.t_conv.ScaleAndOffsetConverter("F", "C", 1.8, 32)
frame = Frame(master)
frame.pack()
L1 = Label(frame, textvariable = self.result_var)
L2 = Label(frame, text = "Deg C")
E = Entry(frame, textvariable=self.c_var)
L3 = Label( frame, text = "Deg F")
B = Button(frame, text = "convert", command = self.convert)
L1.grid(row=1,column=1)
L2.grid(row=1, column=0)
E.grid(row=0, column=1)
L3.grid(row=0,column=0)
B.grid(row=2, columnspan=2)
self.result_var = DoubleVar
def convert(self):
c = self.c_var.get()
self.result_var.set(self.t_conv.convert(c))
root = Tk()
app = App(root)
root.wm_title("Temp Converter")
root.mainloop()
I know that similar questions have been posted to this one but i still don't fully understand how to fix this problem - does anybody know why it is appearing or how to fix it?