Cosinus Drawing
I'd like to make a program which draws a cosinus graph in orderd range. But there is an error which I'm not able to repair. Error Message: 'z = int(self.entry.get()) AttributeError
Solution 1:
Replace:
entry = Entry(self, justify = 'center').grid(row = 2,column = 0,columnspan = 2 ,sticky = E+ W)
entry1 = Entry(self, justify = 'center').grid(row = 2,column = 4,columnspan = 2, sticky = E)
to
self.entry = Entry(self, justify = 'center')
self.entry.grid(row = 2,column = 0,columnspan = 2 ,sticky = E+ W)
self.entry1 = Entry(self, justify = 'center')
self.entry1.grid(row = 2,column = 4,columnspan = 2, sticky = E)
Otherwise, at line z = int(self.entry.get())
, self.entry
would not exist. Also, the grid
method doesn't return anything so, if you do everything in one line as you did, you lose your Entry
object and affect None
to entry
.
Solution 2:
When making the variables, you'll have to set them as instance variables:
self.entry = Entry(self, justify = 'center').grid(row = 2,column = 0,columnspan = 2 ,sticky = E+ W)
self.entry1 = Entry(self, justify = 'center').grid(row = 2,column = 4,columnspan = 2, sticky = E)
Post a Comment for "Cosinus Drawing"