title: Attribute Error: 'str' object has no attribute
body: <p>I am trying to store the data entry for <code>SiteID</code> in the site class variable <code>siteID</code> but I get this attribute error. Can somebody tell me where I'm going wrong?
  The error says: <code>AttributeError: 'str' object has no attribute 'siteID'</code></p>
  
  <pre><code>   from tkinter import *
  
  #Define class for site
  
  class Site(object):
      def __init__(self, siteID, NoFuses, NoCbs, NoPumps):
          self.siteID = siteID
          self.NoFuses = NoFuses
          self.NoCbs = NoCbs
          self.NoPumps = NoPumps
  
      def getSiteID(self):
          return self.siteID
  
      def getNoFuses(self):
          return self.NoFuses
  
      def getNoCbs(self):
          return self.NoCbs
  
      def getNoPumps(self):
          return self.NoPumps
  
  #define class for each network element:
  #Transformer, CB's, Fuses, Cables, Pumps, VFD's
  
  class Transformer(object):
      def __init__(self, TXname, Vprim, Vsec, Imped, phaseShift, XtoR):
          self.TXname = TXname
          self.Vprim = Vprim
          self.Vsec = Vsec
          self.Imped = Imped
          self.phaseShift = phaseShift
          self.XtoR = XtoR
  
      def getTXname(self):
          return self.TXname
  
      def getVprim(self):
          return self.Vprim
  
      def getVsec(self):
          return self.Vsec
  
      def getImped(self):
          return self.Imped
  
      def getPhaseShift(self):
          return self.phaseShift
  
      def getXtoR(self):
          return self.XtoR
  
  class CircuitBreaker(object):
      def __init__(self, equipID, Ir, Im, Isc, tripTime):
          self.equipID = equipID #as read on drawings
          self.Ir = Ir
          self.Im = Im
          self.Isc = Isc #Device current capacity (kA)
          self.tripTime = tripTime
  
      def getEquipID(self):
          return self.equipID
  
      def getIr(self):
          return self.Ir
  
      def getIm(self):
          return self.Im
  
      def getIsc(self):
          return self.Isc 
      def getTripTime(self):
          return self.tripTime
  
  class Fuse(object):
      def __init__(self, fuseType, breakCurr, trip, time):
          self.fuseType = fuseType #HV or LV
          self.breakCurr = breakCurr #device current capacity (kA)
          self.trip = trip #device trip current
          self.time = time #trip time
  
      def getFuseType(self):
          return self.fuseType
  
      def getBreakCurr(self):
          return self.breakCurr
  
      def getTrip(self):
          return self.trip
  
      def getTime(self):
          return self.time
  
  class VFD(object):
      def __init__(self, tagNo, PF, kW, Volts, servFact):
          self.tagNo = tagNo
          self.PF = PF
          self.kW = kW
          self.Volts = Volts
          self.servFact = servFact
  
      def getTagNo(self):
          return self.tagNo
  
      def getPF(self):
          return self.PF
  
      def getkW(self):
          return self.kW
  
      def getVolts(self):
          return self.Volts
  
      def getServFact(self):
          return self.servFact
  
  class Cable(object):
      def __init__(self, cableName, cond, insu, lenth, NoCond, config):
          self.cableName = cableName
          self.cond = cond #conductor type
          self.insu = insu #insulation type
          self.length = length
          self.NoCond = NoCond #number of conductors per phase
          self.config = config #cable configuration (3C+E etc.)
  
      def getCableName(self):
          return self.cableName
  
      def getCond(self):
          return self.cond
  
      def getInsu(self):
          return self.insu
  
      def getLength(self):
          return self.length
  
      def getNoCond(self):
          return self.NoCond
  
      def getConfig(self):
          return self.config
  
  class Pump(object):
      def __init__(self, pumpID, powerFactor, power, poles, voltage, loadFactor):
          self.pumpID
          self.powerFactor = powerFactor
          self.power = power
          self.poles = poles
          self.voltage = voltage
          self.loadFactor = loadFactor
  
      def getPumpID(self):
          return self.PumpID
  
      def getPowerFactor(self):
          return self.powerFactor
  
      def getPower(self):
          return self.power
  
      def getPoles(self):
          return self.poles
  
      def getVoltage(self):
          return self.voltage
  
      def getLoadFactor(self):
          return self.loadFactor
  
  #create gui
  #write variable windows for each class. call these functions in mainwindow()
  
  def storeSite(entry):
      #stores site ID in site class 
      siteID_str = Site.getSiteID(entry.get())
  
  #def storeFuse():
      #stores number of fuses in site class
   #   NoFuses_str = Site.getNoFuses(e1.get())
  
  #def storeCB():
      #stores number of circuit breakers in site class
   #   NoCbs_str = Site.getNoCbs(e2.get())
  
  #def storePump():
      #stores number of pumps in site class
   #   NoPumps_str = Site.getNoPumps(e3.get())
  
  def VariableWindow():
      #creates windows based on MainWindow data entries
      window = Toplevel() 
      window.title('Site Elements')
      window.focus_set()
  
  def MainWindow():     
      root = Tk()
      root.title("Site") #initial window
      root.geometry("500x150")
      app = Frame(root)
      app.grid()
  
      l = Label(app, text = "enter site ID:")
      l.grid(row=0, column=0)
      e = Entry(app)
      e.grid(row=0,column=1) 
      b = Button(app, text = "ok", command = storeSite(e)) 
      b.grid(row=0,column=2)
  
      l1 = Label(app, text = "Enter Number of Fuses (include Transformer HV fuse):")
      l1.grid(row=1, column=0)
      e1 = Entry(app)
      e1.grid(row=1, column=1) 
      b1 = Button(app, text = "ok") 
      b1.grid(row=1,column=2)
  
      l2 = Label(app, text = "Enter Number of Circuit Breakers:")
      l2.grid(row=2, column=0)
      e2 = Entry(app)
      e2.grid(row=2, column=1) 
      b2 = Button(app, text = "ok") 
      b2.grid(row=2, column = 2)
  
      l3 = Label(app, text = "Enter Number of Pumps:")
      l3.grid(row=3, column = 0)
      e3 = Entry(app)
      e3.grid(row=3, column=1) 
      b3 = Button(app, text = "ok") 
      b3.grid(row=3, column=2)
  
      b4 = Button(app, text = "Finish", command = VariableWindow()) #command to prompt next window
      b4.grid(row = 5)
      root.mainloop()
  
  
  #When all data is stored in classes, populate (search replace) 'export' and .dwr files
  </code></pre>