Setting the position on a button in Python?

python, row, tkinter

Solution

astynax is right. To follow the example you gave:

MyButton1 = Button(master, text="BUTTON1", width=10, command=callback)
MyButton1.grid(row=0, column=0)

MyButton2 = Button(master, text="BUTTON2", width=10, command=callback)
MyButton2.grid(row=1, column=0)

MyButton3 = Button(master, text="BUTTON3", width=10, command=callback)
MyButton3.grid(row=2, column=0)

Should create 3 row of buttons. Using grid is a lot better than using pack. However, if you use grid on one button and pack on another it will not work and you will get an error.

Problem

I just wrote a code that creates a window (using TKinter) and displays one working button. ``` b = Button(master, text="get", width=10, command=callback) ``` But i would like to have multiple buttons underneath this one. How do you set the row and column of the button? I tried to add `row = 0, column = 0,` but that would not work. Thanks

Original source