473,383 Members | 1,918 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

Problems with redrawing tables

I am learning how to use tktable. I made a table and put some data in it which appeared. I want to put it into a loop and change the data 5 or 6 times. Right now I am just putting simple data in until I get it to work correctly, just to verify the tables is updated. Later I will put specific data.

My problem though is, I create the array, fill it, pack it, then change the data, pack it, change, and then pack, but it only ever shows the last values that were in the array, not the earlier ones. I even put a sleep command to wait a few seconds between instances, and that prints. Does anyone know what I am doing wrong? Code is below. The sets of dots are printing every second. But it shows only one array with 9*row, 9*column. It should show the array change each time before the three dots (...) are printed.

Code:
----------

Expand|Select|Wrap|Line Numbers
  1. from Tkinter import *
  2. from tktable import *
  3. from time import *
  4.  
  5. root = Tk()
  6.  
  7. var = ArrayVar(root)
  8.  
  9. t = Table(flashmode=1,variable=var)
  10. for z in range(10):
  11.         for y in range(10):
  12.                 for x in range(10):
  13.                         index = "%i,%i" % (y, x)
  14.                         index2 = "%i,%i" % (z*y, z*x)
  15.                         var[index] = index2
  16.  
  17.         t.variable = var
  18.         t.pack()
  19.         sleep(1)
  20.         print "... "
  21.  
  22.  
  23. root = Tk()
  24.  
  25. root.mainloop()
  26.  
Apr 29 '11 #1
4 2320
Oops, the indentation really is correct. It just did not show up in the example above when I cut and pasted.
Apr 29 '11 #2
dwblas
626 Expert 512MB
I don't use or have tktable installed so can't test, but for starters you have two calls to Tk(), i.e. root=Tk() and that can't be good. Also, how does the table know the size since you don't supply the rows and columns when calling Table. Perhaps it can figure it out from the data but then when you add more data there is no room to display it since the table is the size of the original data.
Apr 29 '11 #3
dwblas
626 Expert 512MB
Your code the way that it appears to be indented
Expand|Select|Wrap|Line Numbers
  1. from Tkinter import *
  2. from tktable import *
  3. from time import *
  4.  
  5. root = Tk()
  6.  
  7. var = ArrayVar(root)
  8.  
  9. t = Table(flashmode=1,variable=var)
  10. for z in range(10):
  11.     for y in range(10):
  12.         for x in range(10):
  13.             index = "%i,%i" % (y, x)
  14.             index2 = "%i,%i" % (z*y, z*x)
  15.             var[index] = index2
  16.  
  17. t.variable = var
  18. t.pack()
  19. sleep(1)
  20. print "... "
  21.  
  22.  
  23. root = Tk()
  24.  
  25. root.mainloop() 
Apr 29 '11 #4
I see your concern and you are correct. Right now I am just learning how to use the table. If you do not specify a row it defaults to 10. Same with columns. I will make it more robust later.

I guess my question (or observation) really is that pack() does not happen until the end. Is that true? I mean you can pack your table several times, but only the last one will count since the display is done only once?

By the way thanks for pointing out I forgot to delete one of the Tk() calls. I fixed it now but same problem.
Apr 29 '11 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: ii2o | last post by:
Hi guys, I have a problem where IE is refusing tables to made as hyperlinks. I have some CSS code which makes the background glow if is hovered upon and this works fine both in Firefox and IE....
1
by: Matthias | last post by:
Hello, I created an Access database, with information about Cars & Producers. I've got two tables: - Cars ( GOLF, Chayenne, Beetle etc...) - Producers ( Volkswagen, Ford, GM, Porsche etc...)...
11
by: Ben Holness | last post by:
Hi all, I am having some trouble with some table code. It works fine in Internet Explorer, but the layout doesn't work correctly in Firefox 1.0.7 Is this a firefox bug, or am I missing...
15
by: Gary Peek | last post by:
Can anyone tell us the browsers/versions that exhibit errors when tables are nested too deeply? And how many levels of nesting produces errors? (not a tables vs CSS question)
1
by: Ir0neagle | last post by:
I am generating upgrade/new install scripts for my project. I am able to do this in oracle and sql server but an running into problems in db2. What I am trying to do is to use some logic to only...
2
by: GGawaran | last post by:
Ive setup the MySQL server and am using heidi to create the tables, Ive had no trouble creating any new databases or certain tables. But my problem im running into right now, im trying to create a...
2
Ajm113
by: Ajm113 | last post by:
Ok, I got this small search engine going and right now I have this image as a background for each result it pulls up. I want the text to be lowered to the center so it looks better. Here is the...
0
by: rwschul | last post by:
I have a problem query that I could use some help. This code ran in 20 minutes last year and there is not much change in the input data this year....perhaps 10% growth. Currently this is running 8+...
0
by: imusion | last post by:
Hi, I have 2 servers each running AIX and both have a DB2 database setup on them. I'm building a news management application and in our setup we need to have a staging and production setup. So...
3
by: Rachel Lynn | last post by:
I'm working on the index page of a site and can get the tables to view properly in Safari, but have a gap in both Explorer and Firefox . The page is here: http://ludussports.com/index-test.html I...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.