Is it possible to place a grid of buttons in Tkinter inside another frame?
I want to create a game like tic-tac-toe and I want to use the grid function to put gamesquares (these will be the buttons). However, I would like to have other things in a GUI other than the playing field, so it is not ideal to just have everything in one grid.
To illustrate:
O | X | X | ---------- | O | O | X | Player 2 wins! ---------- | X | O | X |
The tic tac toe board is in the grid consisting of all the buttons, and the β2 player winnerβ is the label inside the frame.
This is a simplification of what I'm trying to do while carrying with me, since I have developed the program so far (the board is dynamically created), the grid makes the most sense.
Edit: Was there a thought, but when I start it, nothing happens? If I select a frame bit, this will happen. Any ideas?
from Tkinter import * root = Tk() b = Button(root, text = "1") b.grid(row=1, column=3) b2 = Button(root, text = "2") b2.grid(row=1, column=4) f = Frame(root, bg = "red") f.pack(side=RIGHT) root.mainloop()
python tkinter grid frame
Sam
source share