Premise: I am trying to make a bunch of buttons in Tkinter and put them in a grid layout one after the other. I don't want to hard code each grid value that way I can add more buttons later with ease.
My first thought was to:
Button(root, text = "example", command = self.example_action).grid(row = count++)
But this did not work, I did some searching and found that python does not have a pre or post increment operator (Behaviour of increment and decrement operators in Python). So my next thought was to:
Button(root, text = "example", command = self.example_action).grid(row = count = count + 1)
This gives: SyntaxError: invalid syntax
So other than splitting my code onto two lines (use the variable then update it on the next line) is there a good way to do this all on one line to make my code more beautiful?