List Problem

Been lurking around here for a few weeks but this is my first post, hello :slight_smile:

I’m still pretty new to python and panda3d, but I have managed to get most of this working. The part that I can’t get to work is the typelist, if I print it out at the end each time its right, but when I call each theme in my menu they are always the last one entered no matter how many different ways I have tried it :frowning:

It’s probably something easy I am overlooking, any help would be great.

from __future__ import with_statement

import glob

themelist = glob.glob("themes/*.gametheme")

themes = []
typelist = []
types = ()


def makeThemeLists():
  for i in themelist:
    with open(i) as f:
        del typelist[:]
        for line in f:
          #print line.strip()
          if line.count("themename=") != 0:
            themename = line.split("=")
            themename = themename[1].strip()
          if line.count("folder=") != 0:
            folder = line.split("=")
            folder = folder[1].strip()
            folder = "themes\\"+folder+"\\"
          if line.count("title=") != 0:
            themetitle = line.split("=")
            themetitle = themetitle[1].strip()
          if line.count("font=") != 0:
            font = line.split("=")
            font = font[1].strip()
            font = loader.loadFont(""+folder+""+font+"")
          if line.count("textR=") != 0:
            r = line.split("=")
            r = r[1].strip()
          if line.count("textG=") != 0:
            g = line.split("=")
            g = g[1].strip()
          if line.count("textB=") != 0:
            b = line.split("=")
            b = b[1].strip()
          if line.count("type=") != 0:
            newtype = line.split("=")
            newtype = newtype[1].strip()
            typelist.append(newtype)
            #types = (typelist)
    theme = (themename, folder, themetitle, font, r, g, b, typelist)
    print theme
    themes.append(theme)

def getThemeList():
  makeThemeLists()
  #print themes
  return themes
  

this is not some thing panda3d specific.

I think glob can act in many different ways.