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

  • SEARCH
  • Home
  • 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 3798888
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T13:38:45+00:00 2026-05-19T13:38:45+00:00

Here’s my current GUI layout for my checkers game: As you can see, it

  • 0

Here’s my current GUI layout for my checkers game:

Checkers game

As you can see, it consists of a Menu along the top, a Canvas on the left where I draw the checkerboard, a toolbar (Frame) on the top right where I have various formatting/navigation buttons, and a Text widget that is used to annotate moves. Currently, I am using a grid layout for the widgets.

Here’s what I need to do:

  1. Be able to show/hide a scrollbar in the Text widget when the amount of text grows larger than the widget size. (This seems to require the grid layout, according to this article.)
  2. Change the font and/or size of the text in the Text widget [via a Preferences dialog] and not leave weird gaps around the Text widget. (This seems to require a pack layout because the Text widget can only be given a width and height in characters not pixels … that means the Text widget grows or shrinks when I change the font or size, and the window won’t adjust to fit with a grid layout. I’ve been trying to use Font.measure to adjust the Text widget size according to the font selected, but I still get gaps because I can’t resize the widget down to the exact pixel.)
  3. My final solution needs to be cross-platform (both Windows & Linux, and hopefully Mac).

Which layout can I use to meet my requirements? If neither will work completely, which layout (grid or pack) will get me closest to my goal? Thanks!

  • 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-19T13:38:46+00:00Added an answer on May 19, 2026 at 1:38 pm

    For this simple layout you could use grid, pack or both. Neither has a clear advantage in this particular case. Both have the resize behavior you desire.

    Off the top of my head I would use a horizontal frame to hold the buttons, and pack the buttons in it. I would then probably use grid to place the toolbar, text widget and scrollbar inside a frame. Pack can be used too, either would work. That takes care of the right side.

    If you want the menubar the way it is in the picture (ie: non-standard, only over the chessboard) I would use a similar technique: another frame for the left side with the menubar packed on the top, chessboard on the bottom.

    i would then use pack in the main window, with statusbar on the bottom, the chessboard on the left, and then the text area on the right.

    However, it’s better to use a standard menubar which means you don’t need a containing frame for the chessboard/menubar combination

    Here’s a quick hack at one solution using a standard menubar. This uses the technique of putting most widgets as children of the parent, then using the in_ parameter to put them in a container. This makes it much easier to change the layout later since you don’t have to change a whole hierarchy, but only placement of widgets in containers.

    import Tkinter as tk
    import random
    
    class App(tk.Tk):
        def __init__(self, *args, **kwargs):
            tk.Tk.__init__(self, *args, **kwargs)
    
            size = 40
            menubar = tk.Menu(self)
            menubar.add_cascade(label="Game")
            menubar.add_cascade(label="Options")
            menubar.add_cascade(label="Help")
            chessboard = tk.Canvas(width=8*size, height=8*size, borderwidth = 0,
                                   highlightthickness=0)
            statusbar = tk.Label(self, borderwidth=1, relief="sunken")
            right_panel = tk.Frame(self, borderwidth = 1, relief="sunken")
            scrollbar = tk.Scrollbar(orient="vertical", borderwidth=1)
            # N.B. height is irrelevant; it will be as high as it needs to be
            text = tk.Text(background="white",width=40, height=1, borderwidth=0, yscrollcommand=scrollbar.set)
            scrollbar.config(command=text.yview)
    
            toolbar = tk.Frame(self)
            for i in range(10):
                b = tk.Button(self, text="B%s" % i, borderwidth=1)
                b.pack(in_=toolbar, side="left")
    
            self.config(menu=menubar)
            statusbar.pack(side="bottom", fill="x")
            chessboard.pack(side="left", fill="both", expand=False)
            toolbar.grid(in_=right_panel, row=0, column=0, sticky="ew")
            right_panel.pack(side="right", fill="both", expand=True)
            text.grid(in_=right_panel, row=1, column=0, sticky="nsew")
            scrollbar.grid(in_=right_panel, row=1, column=1, sticky="ns")
            right_panel.grid_rowconfigure(1, weight=1)
            right_panel.grid_columnconfigure(0, weight=1)
    
    if __name__ == "__main__":
        app = App()
        app.mainloop()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here's the basic setup: I have a thin bar at the top of a
Here's a coding problem for those that like this kind of thing. Let's see
Here is format what I want to get yyMMddHHmmssWWNZ array<Char>^date_ = this->date_datepicker->Value.ToString(yyMMddHHmmssWWNZ)->ToCharArray(); How can
Here's my fiddle - http://jsfiddle.net/UBHj8/ So my problem is pretty obvious, just can't seem
Here's the view: @if (stream.StreamSourceId == 1) { <img class=source src=@Url.Content(~/Public/assets/images/own3dlogo.png) alt= /> }
Here's my code in the <head></head> : <link rel=stylesheet href=http://code.jquery.com/mobile/1.1.0/jquery.mobile-1.1.0.min.css /> <script type=text/javascript src=http://code.jquery.com/jquery-1.7.1.min.js></script>
Here is the code in a function I'm trying to revise. This example works
Here is the code: create table `team`.`User`( `UserID` bigint NOT NULL AUTO_INCREMENT , `Username`
Here is my work environment: Eclipse Juno as IDE with maven2 plugin on it
Here is what I am currently doing. PHP echo's out the recent post in

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.