Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 767725
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T18:04:12+00:00 2026-05-14T18:04:12+00:00

Is it possible to place a grid of buttons in Tkinter inside another frame?

  • 0

Is it possible to place a grid of buttons in Tkinter inside another frame?

I’m wanting to create a tic-tac-toe like game and want to use the grid feature to put gamesquares (that will be buttons). However, I’d like to have other stuff in the GUI other than just the game board so it’s not ideal to just have everything in the one grid.

To illustrate:

O | X | X   |
----------  |
O | O | X   | Player 2 wins!
----------  | 
X | O | X   |

The tic tac toe board is in a grid that is made up of all buttons and the ‘player 2 wins’ is a label inside a frame.

This is an oversimplification of what I’m trying to do so bear with me, for the way I’ve designed the program so far (the board is dynamically created) a grid makes the most sense.

Edit: Had a thought but when I run it, nothing happens? If I take out the frame bit it does. 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()
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T18:04:13+00:00Added an answer on May 14, 2026 at 6:04 pm

    Figured out a way to do it finally:

    from Tkinter import * 
    
    root = Tk()
    
    f = Frame(root, bg = "orange", width = 500, height = 500)
    f.pack(side=LEFT, expand = 1)
    
    f3 = Frame(f, bg = "red", width = 500)
    f3.pack(side=LEFT, expand = 1, pady = 50, padx = 50)
    
    f2 = Frame(root, bg = "black", height=100, width = 100)
    f2.pack(side=LEFT, fill = Y)
    
    b = Button(f2, text = "test")
    b.pack()
    
    b = Button(f3, text = "1", bg = "red")
    b.grid(row=1, column=3)
    b2 = Button(f3, text = "2")
    b2.grid(row=1, column=4)
    b3 = Button(f3, text = "2")
    b3.grid(row=2, column=0)
    
    root.mainloop()
    

    Having the grid inside a frame inside a frame is a bit of a hack to get the padding around the grid working but it works so I’m happy.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.