本文整理汇总了Python中timeline.Timeline.drawRectangles方法的典型用法代码示例。如果您正苦于以下问题:Python Timeline.drawRectangles方法的具体用法?Python Timeline.drawRectangles怎么用?Python Timeline.drawRectangles使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类timeline.Timeline
的用法示例。
在下文中一共展示了Timeline.drawRectangles方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Window
# 需要导入模块: from timeline import Timeline [as 别名]
# 或者: from timeline.Timeline import drawRectangles [as 别名]
class Window(QtGui.QMainWindow):
def __init__(self):
super(Window, self).__init__()
self.ctr = 0
self.timeline = Timeline()
self.signals_slots = signals_slots.Signal_Slots()
#timer for animation
#self.timer = QtCore.QTimer(self)
#self.connect(self.timer,
# QtCore.SIGNAL("timeout()"),
# self.update)
#self.timer.start(DELAY)
def setup_connections( self, ui ) :
ui.actionExit.triggered.connect(QtCore.QCoreApplication.instance().quit )
ui.actionOpen.triggered.connect(lambda: self.signals_slots.open_file(self, ui))
ui.playButton.clicked.connect(lambda: self.signals_slots.start_playback(self, ui))
ui.stopButton.clicked.connect(lambda: self.signals_slots.stop_playback(self, ui))
ui.seekSlider.setMediaObject(ui.videoPlayer.mediaObject())
ui.volumeSlider.setAudioOutput(ui.videoPlayer.audioOutput())
#ticker
ui.videoPlayer.mediaObject().tick.connect(self.tick)
def paintEvent(self, e):
print "paintEvent called"
start = {"x" : 170, "y" : 410 }
end = {"x" : 430, "y" : 500}
lines = { "short" : 5, "long" : 12 }
qp = QtGui.QPainter()
qp.begin(self)
self.timeline.drawRectangles(qp, start, end, lines)
self.timeline.drawLines(qp, start, end, lines)
self.timeline.drawTicker(qp, start, end, lines, self.ctr)
qp.end()
#def update( self) :
# print "something"
# self.ctr = self.ctr + 1
# print self.ctr
# self.repaint()
def tick(self, time):
displayTime = QtCore.QTime(0, (time / 60000) % 60, (time / 1000) % 60).second()
print displayTime * 10
self.ctr = displayTime * 10
self.repaint()