Hi all,

sorry for long message but just read the red highlighted lines I am facing a 
problem with gauge update. I want to return a value from another script file 
but the problem is this value locate inside a loop. example :

the mean running script :

m=0
# this function to return any value from different script
def return_values(value):
    global m
    m= value
    #print m
    return value

def create(parent):
    return ANN(parent)

[wxID_ANN, wxID_ANNBUTTON1, wxID_ANNFILEBROWSEBUTTON1, 
... so on
[wxID_ANNMENUFILEEXIT, wxID_ANNMENUFILEOPEN, wxID_ANNMENUFILESAVE, 
] = [wx.NewId() for _init_coll_menuFile_Items in range(3)]

[wxID_ANNMENUHELPABOUT] = [wx.NewId() for _init_coll_menuHelp_Items in range(1)]

class ANN(wx.Frame):
    def _init_coll_menuBar1_Menus(self, parent):
        # generated method, don't edit

        parent.Append(menu=self.menuFile, title='File')
        parent.Append(menu=self.menuHelp, title='Help')

    def _init_coll_menuHelp_Items(self, parent):
        # generated method, don't edit

def _init_ctrls(self, prnt):
    # generated method, don't edit
    wx.Frame.__init__(self, id=wxID_ANN, name='ANN', parent=prnt,
          pos=wx.Point(386, 130), size=wx.Size(715, 565),
          style=wx.DEFAULT_FRAME_STYLE, title='Artificial Neural Network')
    self._init_utils()
    self.SetClientSize(wx.Size(699, 527))
    self.SetMenuBar(self.menuBar1)

    self.panel1 = wx.Panel(id=wxID_ANNPANEL1, name='panel1', parent=self,
          pos=wx.Point(0, 0), size=wx.Size(699, 484),
          style=wx.TAB_TRAVERSAL)

    self.gauge1 = wx.Gauge(id=wxID_ANNGAUGE1, name='gauge1',
          parent=self.panel2, pos=wx.Point(200, 112), range=100,
          size=wx.Size(100, 28), style=wx.GA_HORIZONTAL)
    self.gauge1.SetValue(0)
    self.gauge1.SetLabel('')
and so on ...

def OnNormtrainingButton(self, event):
    self.data= self.fileBrowseButton1.GetValue()
    target= self.fileBrowseButton2.GetValue()
    import normalization
    self.gauge1.Value=0
    no= normalization.Norm()
    no.read_norm_data(data)
    #self.gauge1.Value=
    print m


the second script is: normalization.py
def read_norm_data(self, inputsData):
    
    self.pat=[]
    tragauge=0;totalrange= float(len(open(inputsData).readlines())) #for the 
gauge process
    
    while True:
    # read the input data
        line = f.readline()
        if len(line)==0:
           break
        inputs=line.split()
        self.inputs=map(float,inputs)
        #print self.inputs

        # for the training data norm gauge process
        self.traininggauge = ((tragauge+1)/totalrange)*100
        tragauge=tragauge+1
        ann.return_values(self.traininggauge) ############# HERE is the gauge 

from the last line I need this value to go in side the mean frame and update 
the gauge.
I can return the value into the mean file but couldn’t make it for the gauge 
cuz the gauge is inside the ANN class which I couldn’t go inside it.
I am trying to do that by make it as a global varible and update but it’s keep 
give me the same initial value m=0.

may be I can get it by sending the value and the gauge into a new script and 
update the gauge but I think this is not a proper way.

Any idea!
Best regards,
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to