Hi!
Thanks for much for your reply! I'm sorry my posting was so
confusing...It's partially because my understanding is so hazy right now.
I'm trying to piece together what I should do next...
Based on your example...
My understanding is that if I desire the following tree control structure
in my GUI:
australia
europe
-> spain
-> germany
-> belgium
north america
-> united states
-> -> california
-> -> oregon
-> -> arizona
-> canada
asia
That my nested list will look something like this....(NOTE) I believe that
I will need to include the parent root node IN the list like this (not
outside of it before the children):
geo=[
"australia",
["europe",
["spain",
"germany",
"belgium",]],
["north america",
["united states",[
"california",
"oregon",
"arizona"],
"canada"]],
"asia"]
Currently the format of my data are lists from queries such as:
Select Distinct(Continent) from world_globe; --> Query returns a list -->
["australia", "europe", "north america", "asia"]
Select Distinct(Country) from world_globe
where continent = "europe"; --> Query returns a list -->
["spain", "germany", "belgium"]
Select Distinct(State) from world_globe
where country = "united states"; --> Query returns a list -->
["california", "oregon", "arizona"]
ETC....
So my lists are these:
continent = ["australia", "europe", "america", "asia"]
country = [["spain", "germany", "belgium"], ["united states", "canada"]]
state = ["california", "oregon", "arizona"]
So ... what I have:
The data is already split out into nodes. Clearly my tree will be 3 deep.
Continent
-> Country
-> State
What I don't have - aka my questions??????:
I think I need a list of nested lists...and they need to be in the proper,
logical order. I can't simply iterate on continent inserting the lists
from Country because they don't associate themselves with the correct
objects. It would become for example:
tree_list = ["australia", ["spain", "germany", "belgium"], "europe",
["united states", "canada"], "america", "asia"
...logically representing this (which is wrong):
australia
-> spain
-> germany
-> belgium
europe
-> united states
-> canada
america
asia
Also, I believe that the parent of the children needs to INSIDE a list
with it's children. For example this:
geo = ["australia", ["europe",["spain", "germany", "belgium"]]] <--
Correct (I believe)
NOT THIS...
geo = ["australia", "europe", ["spain", "germany", "belgium"]] <--
Incorrect (I believe)
***********
I need assistance getting from here:
continent = ["australia", "europe", "america", "asia"]
country = [["spain", "germany", "belgium"], ["united states", "canada"]]
state = ["california", "oregon", "arizona"]
To here:
geo=[
"australia",
["europe",
["spain",
"germany",
"belgium",]],
["north america",
["united states",[
"california",
"oregon",
"arizona"],
"canada"]],
"asia"]
Thanks Again!
Lauren
_______________________________________________
Tutor maillist - [email protected]
http://mail.python.org/mailman/listinfo/tutor