D
dittonamed
Code pasted below ----->
Can anyone out there suggest a way to access the object "p" thats
started in playAudio() from inside the stopAudio()? I need the object
reference to use QProcess.kill() on it. The code sample is below.
Thanks to anyone who helps out =)
More comments in the code below ------>
from qt import *
class Form2(QMainWindow):
def __init__(self,parent = None,name = None,fl = 0):
QMainWindow.__init__(self,parent,name,fl)
self.statusBar()
def playAudio(self):
p = QProcess(self, 'player')
playcmd = '/usr/bin/play'
filename = 'song.ogg'
p.addArgument(playcmd)
p.addArgument(filename)
p.start()
def stopAudio(self):
''' #This is just to show that i can "see" the object, though
i
#dont know how to "access" it
#the output shows the QProcess object by name...
# but how do i reference it??
allobjs = list(QObject.objectTrees())
for obj in allobjs:
objName = QObject.name(obj)
if objName == 'Form2':
print QObject.children(obj)
'''
QProcess.kill(NEED THE REFERENCE HERE)
Can anyone out there suggest a way to access the object "p" thats
started in playAudio() from inside the stopAudio()? I need the object
reference to use QProcess.kill() on it. The code sample is below.
Thanks to anyone who helps out =)
More comments in the code below ------>
from qt import *
class Form2(QMainWindow):
def __init__(self,parent = None,name = None,fl = 0):
QMainWindow.__init__(self,parent,name,fl)
self.statusBar()
def playAudio(self):
p = QProcess(self, 'player')
playcmd = '/usr/bin/play'
filename = 'song.ogg'
p.addArgument(playcmd)
p.addArgument(filename)
p.start()
def stopAudio(self):
''' #This is just to show that i can "see" the object, though
i
#dont know how to "access" it
#the output shows the QProcess object by name...
# but how do i reference it??
allobjs = list(QObject.objectTrees())
for obj in allobjs:
objName = QObject.name(obj)
if objName == 'Form2':
print QObject.children(obj)
'''
QProcess.kill(NEED THE REFERENCE HERE)