[Tutor] looking for alternatives to tabular widget (Tkinter)
Mon Apr 7 17:09:02 2003
I really need a program for managing all the cdroms i have
(data cdroms). Since I haven't found anything suitable for me
that runs on Linux, I have begun to write my own
application ... in python (using PostgreSQL for storing the data).
I have already written a small utility that reads the cdrom and
inserts the data in the database (it was amazingly easy .. Python's
os.path.walk() did everything almost itself).
The next phase is creating a nice user interface for browsing
the contents of the cdroms, using Tkinter.
Since Tkinter doesn't provide any widget for displaying tabular
data, i am not sure how could i display the contents
of the following table:
create table DIRS ( CD integer, // cdrom id
DIR integer, // directory id
DIR_NAME text, // directory name
CATEG integer, // category
DESC varchar(50) ); // description
The first 3 columns are read-only. The user should be able to
modify easily the last 2 columns (Category and Description).
When the user navigates from one directory to another, the
program should display the files contained in that directory
in a similar manner (this is to be done later).
I thought about it and i came up with an idea, but i'm not
sure if it is a good one:
- using a ListBox for the read-only fields (i could concatenate
them, or i could use only DIR_NAME). Let's say that 15
records will be visible at one time.
- creating 15 pairs of Entry widgets
- the user jumps from one recod to another using the Listbox,
and the program will sinchronize the Entry fields so that
they will allways contain the values that
correspond to the directories visible in the Listbox.
- the data is stored into a list of dictionaries (done already)
| dir1 | ( category1 ) ( description1 )
| dir2 | ( category2 ) ( description2 )
| dir3 | ( category3 ) ( description3 )
...... .... ....
| | ( category14 ) ( description14 )
| dir15 | ( category15 ) ( description15 )
Does this sound feasible? Is there perhaps a better approach?
Thank you for spending some time to read my question.