Reputation: 393
I am trying to configure the "pady
" keyword of entries that I have stored in a dictionary. But an error occurs every time I try to configure the pady
keyword.
for i in range(1, 4):
temp = Entry(self.right_child, width=9)
temp.insert(END, i)
self.entries[f'{name}{i}'] = temp
temp.grid(row=row, column=i-1, padx=(0,2), pady=(0,2))
All of my attempts shown below raises the same error
tkinter.TclError: unknown option "-pady"
Here are my attempts:
self.entries['Afkastnignsgrad,%1']['pady'] = (0,25) # 1
self.entries['Afkastnignsgrad,%1'].configure(pady = (0,25)) # 2
self.entries['Afkastningsgrad,%1'].config(pady = (0,25)) # 3
Upvotes: 1
Views: 1267
Reputation: 385970
The error message is telling you exactly what the problem is: pady
is not a valid option for an entry widget. pady
is an option for the grid
(and pack
) command.
If you want to change the padding for a widget that was added to the display with grid
, you must use grid_configure
. For example:
self.entries['Afkastnignsgrad,%1'].grid_configure(pady=(0,25))
Upvotes: 2