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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T01:45:00+00:00 2026-06-05T01:45:00+00:00

The example GUI in the imported TkTable module works fine. But when I try

  • 0

The example GUI in the imported TkTable module works fine. But when I try to use TkTable in my own work, every cell in the table is empty. My test code is below

from Tkinter import *
import TkTable

class App:

    def __init__(self, master): 
        """master is the top level window"""


        master.geometry(("%dx%d")%(250,60))
        master.title("Test")

        frame = Frame(master)
        frame.pack()

        var = TkTable.ArrayVar(frame)
        for y in range(6):
            for x in range(6):
                index = "%i,%i" % (y, x)
                var[index] = index

        label = Label(frame, text="test2")
        label.pack(side = 'top', fill = 'x')

        quit = Button(frame, text="QUIT", command=root.destroy)
        quit.pack(side = 'bottom', fill = 'x')

        test = TkTable.Table(frame,
                 rows=6,
                 cols=6,
                 state='disabled',
                 width=6,
                 height=6,
                 titlerows=1,
                 titlecols=0,
                 roworigin=0,
                 colorigin=0,
                 selectmode='browse',
                 selecttype='row',
                 rowstretch='unset',
                 colstretch='last',
                 flashmode='on',
                 variable=var,
                 usecommand=0)
        test.pack(expand=1, fill='both')
        test.tag_configure('sel', background = 'yellow')
        test.tag_configure('active', background = 'blue')
        test.tag_configure('title', anchor='w', bg='red', relief='sunken')


root = Tk()
app = App(root)
root.mainloop()

The window displayed has a table with all empty cells.

I’m using Python 2.6, Mac OS 10.6, and Eclipse PyDev though I don’t think any of that matters. What I think does matter, but I can’t pinpoint why, is that the example code ( http://tkinter.unpy.net/wiki/TkTableWrapper ) provided in the TkTable module I downloaded from SourceForge runs the table in a slightly different way. It has:

if __name__ == '__main__':
    sample_test()

where sample_test() contains

root = Tk() 

and

root.mainloop()

Why does that example method work but mine does not? Thank you in advance for any help you can offer.

  • 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-05T01:45:03+00:00Added an answer on June 5, 2026 at 1:45 am

    You may want to read up on local variables versus global variables versus instance variables!

    Replace all occurrences of var with self.var.

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

Sidebar

Related Questions

Every example I can find either goes through creating a table without a gui
I have created a GUI that will setup the pivot table. For example, I
From here I've copied an example of python gui app, but it's not working.
Is there a simple complete code example using any gui toolkit (that will work
Advise the GUI tool for viewing dependent object database MySQL. for example: USE db;
in the book that i'm reading, every example of GUI with multithreading has something
I have some GUI controls in WinForms application. For example i have log control
I have a problem in compiling a qt example from c++ GUI programming with
i am looking for some methods to improve swing gui for example i want
It's said that composition is preferred over inheritance. Every single open source GUI toolkit

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.