Hello,
I have an issue with a certain part of my code. I create the following list which holds the values read in from the user via tk.Entry widgets for the purspose of iteration so that I can condense my code. It is created inside the init method at the time of initialization. Note that the inputs read in are technically strings but what is entered are digits and floats. For example: 7, 1.3, 8, 3.4, etc.
# Create list for iteration purposes in get_poles_zeros() method
self.values = [self.zeros1, self.poles1, self.zeros2, self.poles2, self.gain]
I have a button ('Plotâ) which provides a callback to the following method:
def get_poles_zeros(self, *args):
j = 0
for item in self.values:
temp = item.get()
print(temp)
value = [float(s) for s in re.findall(r'-?\d+\.?\d*', temp)]
self.values[j] = value
j += 1
self.plot_tf()
print('Exited get_poles_zeros()')
When I run my code, it works fine, for the first run.
I then press another button (the Reset button), which has the following callback method
(it clears all of the entered strings/values in the tk.Entry widgets):
def clear_entries(self):
self.gain.delete(0, 'end')
self.zeros1.delete(0, 'end')
self.zeros2.delete(0, 'end')
self.poles1.delete(0, 'end')
self.poles2.delete(0, 'end')
After pressing the Reset button, I reenter new values into the tk.Entry inputs for a new calculation. When I press the âPlotâ button, I receive the following error:
AttributeError: 'list' object has no attribute 'get'
Can someone please advise.