Hi,
I have a UI with 2 buttons that controls playback, "play" and "stop". It
works good.
When the playback is running I would like to get and print the currentTime.
But I dont't know how to call the print function at each frame. I guess
it's related with event handler, but I am absolutely not familiar with it
in python.
Can someone help or give direction to solve this ? thx
import pymel.core as pm
class PlayBackPrinter():
def __init__(self):
self.drawUI()
self.state = False
def drawUI(self):
if pm.window("UI_MainWindow", exists = True):
pm.deleteUI("UI_MainWindow")
pm.window("UI_MainWindow", title = "test playback...", w = 150, h =
150, mnb = False, mxb = False, sizeable = True)
pm.columnLayout("UI_MainLayout", w = 150, h =300)
pm.button("UI_pbStartButton", label = "Start", w = 150,
command=self.pbStart)
pm.button("UI_pbStopButton", label = "Stop", w = 150,
command=self.pbStop)
pm.showWindow("UI_MainWindow")
def pbStart(self,*args):
pm.play(state=True)
self.state = True
# print str("state : " +str(self.state))
def pbStop(self,*args):
pm.play(state=False)
self.state = False
# print str("state : " +str(self.state))
def pbPrintCurrentTime(self):
print pm.currentTime()
def pbListener(self):
t = pm.currentTime()
def main():
pbPrinter = PlayBackPrinter()
while pbPrinter.state==True:
pbPrinter.pbPrintCurrentTime()
main()
--
You received this message because you are subscribed to the Google Groups
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/python_inside_maya/30e1cd66-5400-4631-b84d-b3b51469d4f9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.