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 8228263
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T16:24:24+00:00 2026-06-07T16:24:24+00:00

I have been learning Tkinter, i have written a small code where i want

  • 0

I have been learning Tkinter, i have written a small code where i want three frames to be part of an frame. Now when i execute this code line by line, then it works as expected. However on running it as a whole program there is lot of white space between frame 1 and frame2.

from Tkinter import *
tk = Tk()
tk.geometry("")
main_frame = Frame(tk)
main_frame.grid(row=0)
frame1 = Frame(main_frame, bg="blue", width=200, height=400, borderwidth =1)
frame1.grid(row=0, column=0)
frame2 = Frame(main_frame, bg="green", width=800, height=400)
frame2.grid(row=0, column=1)
frame3 = Frame(main_frame, bg="orange", width=1000, height=100)
frame3.grid(row =1)
tk.mainloop()

Other problem is if i maximize the window and change it back to original size or I stretch this main window. I see frames gets overlapped and some ghost images. Can some one explain this weird behavior.

Regards

  • 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-06-07T16:24:25+00:00Added an answer on June 7, 2026 at 4:24 pm

    The problem is with the way you’re gridding it. by default, every object gets gridded into a single block. So, you’re grid looks something like this:

     -------------------------------
     |    frame 1     |  frame 2   |
     -------------------------------
     |    frame 3     |  nothing   |
     -------------------------------
    

    In this case, the area the frame1 is sitting in gets expanded to accomodate frame3 since frame3 is so much bigger. The workaround here is to specify the columnspan keyword to allow frame3 to span more than 1 column on the grid.

    frame3.grid(row=1,column=0,columnspan=2)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been learning python for some time now. While starting this learning python
I have been learning iOS development for a few days now. At this moment,
I have been learning C++ for three months now and in that time created
I have been learning Scala for the past couple of months and now I
I have been learning Python for a while, and now I'd like to learn
I have been learning php for sometime now. Besides reading books and doing tutorials
I have been learning Ruby lately, and I want to upload a test web
I have been learning about various functional languages for some time now including Haskell,
I have been learning MFC these days.I want to draw lines with MoveTo() and
I have been learning android development and I am still new to this. I

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.