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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T23:40:23+00:00 2026-06-11T23:40:23+00:00

I’ve am new to Tkinter and have written a program to open a file

  • 0

I’ve am new to Tkinter and have written a program to open a file and parse binary messages.

I am struggling on how best to display the results. My parsing class will have 300+ entries and I want something similar to a table.

var1Label : var1Val

var2Label : var2Val

I have played around with these widgets but have not gotten anything that I can be proud of: Label, Text, Message and probably others.

So I’d like the Labels to be justify Right, and the Var’s to be justify left or anything else that would that would be a good idea on how to make this an attractive display, like having all the ‘:’ aligned. The size of the Var’s will be between 0-15 characters.

I’m using python 2.7.2 on windows.

Here’s the grid method I was trying with dummy variables

self.lbVar1 = Label(self.pnDetails1, text="Var Desc:", justify=RIGHT, bd=1)
self.lbVar1.grid(sticky=N+W)
self.sVar1 = StringVar( value = self.binaryParseClass.Var1 )
self.Var1  = Label(self.pnDetails1, textvariable=self.sVar1)
self.Var1.grid(row=0, column=1, sticky=N+E)
  • 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-11T23:40:25+00:00Added an answer on June 11, 2026 at 11:40 pm

    The ttk.Treeview widget lets you create a list of objects with multiple columns. It will probably be the easiest thing for you to use.

    Since you specifically asked about a grid of labels, here is a quick and dirty example showing how to create 300 items in a scrollable grid:

    import Tkinter as tk
    class ExampleApp(tk.Tk):
        def __init__(self):
            tk.Tk.__init__(self)
    
            # create a canvas to act as a scrollable container for
            # the widgets
            self.container = tk.Canvas(self)
            self.vsb = tk.Scrollbar(self, orient="vertical", command=self.container.yview)
            self.container.configure(yscrollcommand=self.vsb.set)
            self.vsb.pack(side="right", fill="y")
            self.container.pack(side="left", fill="both", expand=True)
    
            # the frame will contain the grid of labels and values
            self.frame = tk.Frame(self)
            self.container.create_window(0,0, anchor="nw", window=self.frame)
    
            self.vars = []
            for i in range(1,301):
                self.vars.append(tk.StringVar(value="This is the value for item %s" % i))
                label = tk.Label(self.frame, text="Item %s:" % i, width=12, anchor="e")
                value = tk.Label(self.frame, textvariable=self.vars[-1], anchor="w")
                label.grid(row=i, column=0, sticky="e")
                value.grid(row=i, column=1, sticky="ew")
    
            # have the second column expand to take any extra width
            self.frame.grid_columnconfigure(1, weight=1)
    
            # Let the display draw itself, the configure the scroll region
            # so that the scrollbars are the proper height
            self.update_idletasks()
            self.container.configure(scrollregion=self.container.bbox("all"))
    
    if __name__ == "__main__":
        app = ExampleApp()
        app.mainloop()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i want to parse a xhtml file and display in UITableView. what is the
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
I have just tried to save a simple *.rtf file with some websites and
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I want use html5's new tag to play a wav file (currently only supported
I have a French site that I want to parse, but am running into
In my XML file chapters tag has more chapter tag.i need to display chapters
I have a reasonable size flat file database of text documents mostly saved in
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
I have a jquery bug and I've been looking for hours now, I can't

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.