I'm using tkinter to create a calculator, and want to minimise the code for my buttons. How can I make an efficient for loop with the lambda command still included? Below is an example of the code used to create my buttons
self.seven = Button(self, text = "7", width = 10, height = 3, cursor = "hand2", command = lambda: (self.expression(7))).grid(row = 1, column = 0, padx = 1, pady = 1)
self.eight = Button(self, text = "8", width = 10, height = 3, cursor = "hand2", command = lambda: (self.expression(8))).grid(row = 1, column = 1, padx = 1, pady = 1)
self.nine = Button(self, text = "9", width = 10, height = 3, cursor = "hand2", command = lambda: (self.expression(9))).grid(row = 1, column = 2, padx = 1, pady = 1)