pass parameters inside of wxpython app

Hello everyone,
I am having a problem trying to pass parameters in and out of functions in a wxpython app.
I can get the my functions to pass parameters in a regular python script, but not in the wxpython application. I used wxglade to build app.
I have bound a button to function GeditOpen.
Code:

def getPid(self,event):
    child1 = subprocess.Popen(["./gedit"], cwd="/usr/bin")
    bruce = child1.pid
    return bruce

I have another button bound to function OnClose:
Code:

def OnDisc(self,event):
       os.kill(getPid('pid'),15)
       self.Close()

I get "NameError: global name 'getPid' is not defined"
I do not want to use global variables,as this is bad practice.
any help would be appreciated.
thanks,
Brad

chris botos wrote:

    Code:

    def getPid(self,event):
       child1 = subprocess.Popen(["./gedit"], cwd="/usr/bin")
       bruce = child1.pid
       return bruce

    I have another button bound to function OnClose:
    Code:

    def OnDisc(self,event):
          os.kill(getPid('pid'),15)
          self.Close()

    I get "NameError: global name 'getPid' is not defined"
    I do not want to use global variables,as this is bad practice.
    any help would be appreciated.
    thanks,
    Brad

Brad,
I don't totally understand what your app is doing, but can I assume these are both methods of the same class? If so, you need to say:
     os.kill(self.getPid('pid'),15)
Chris Botos

Chris,
thanks for the response. The app is basically using x11vnc and stunnel to make a secure reverse vnc connection. The connect button is:
def OnConn(self,event):
        #global child1
        #global child2
                  l = self.combo_box_1.GetValue()
        if l == "Please Choose Support Site":
           print "error"
        if l == "Support Alpha":
            child1 = subprocess.Popen(["./stunnel","stunnel.conf"], cwd="bin")
            t = child1.pid
            return t
            time.sleep(3)
            child2 = subprocess.Popen(["./x11vnc","--connect","localhost:5500"], cwd="bin")
            z = child2.pid
            return z

Then on the disconnect button I have:
def OnDisc(self,event):
        os.kill(self.OnConn('pid'),15)
        self.Close()
       The problem now is self.OnConn('pid') launches function again, and does not kill process. I just need to
kill both subprocesses when the disconnect button is pushed.
Thanks again.

···

On 3/28/07, *bradleyd* <syhsolutions@comcast.net > <mailto:syhsolutions@comcast.net>> wrote: