本文整理汇总了Python中video.Video.screenSet方法的典型用法代码示例。如果您正苦于以下问题:Python Video.screenSet方法的具体用法?Python Video.screenSet怎么用?Python Video.screenSet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类video.Video
的用法示例。
在下文中一共展示了Video.screenSet方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Gui
# 需要导入模块: from video import Video [as 别名]
# 或者: from video.Video import screenSet [as 别名]
class Gui(QtGui.QWidget):
# =========================================================================
def __init__(self, parent=None):
super(Gui, self).__init__(parent)
self.videoComboBox = QtGui.QComboBox(self)
self.videoComboBox.currentIndexChanged.connect(self.videoIndexChanged)
self.audioComboBox = QtGui.QComboBox(self)
self.audioComboBox.currentIndexChanged.connect(self.audioIndexChanged)
self.recordPushButton = QtGui.QPushButton(self)
self.recordPushButton.setCheckable(True)
self.recordPushButton.clicked.connect(self.recordClicked)
separator = QtGui.QFrame(self)
separator.setFrameStyle(QtGui.QFrame.HLine|QtGui.QFrame.Sunken)
layout = QtGui.QVBoxLayout(self)
layout.addWidget(self.videoComboBox)
layout.addWidget(self.audioComboBox)
layout.addWidget(separator)
layout.addWidget(self.recordPushButton)
self.setLayout(layout)
self.resetToDefault()
# =========================================================================
def resetToDefault(self):
self.video = Video()
self.audio = Audio()
self.populateVideoComboBox()
self.populateAudioComboBox()
self.recordPushButton.setIcon(QtGui.QIcon(os.path.join(scriptDir, 'rec_btn_off.svg')))
self.recordPushButton.setChecked(False)
self.recordPushButton.setEnabled(False)
# =========================================================================
def populateVideoComboBox(self):
self.videoComboBox.clear()
self.videoComboBox.addItem('Select video screen...')
for screen in self.video.screens:
comboBoxItem = 'Screen {i}, size {s}'.format(
i=self.videoComboBox.count(), s=screen.size)
self.videoComboBox.addItem(comboBoxItem)
# =========================================================================
def populateAudioComboBox(self):
self.audioComboBox.clear()
self.audioComboBox.addItem('Select audio device...')
for device in self.audio.devices:
comboBoxItem = '{d}'.format(d=device.description)
self.audioComboBox.addItem(comboBoxItem)
# =========================================================================
def videoIndexChanged(self, index):
if index:
self.video.screenSet(index - 1)
self.checkEnableRecord()
# =========================================================================
def audioIndexChanged(self, index):
if index:
self.audio.deviceSet(index - 1)
self.checkEnableRecord()
# =========================================================================
def recordClicked(self):
if self.recordPushButton.isChecked():
self.videoComboBox.setEnabled(False)
self.audioComboBox.setEnabled(False)
self.recordPushButton.setIcon(QtGui.QIcon(os.path.join(scriptDir, 'rec_btn_on.svg')))
self.startRecorder()
else:
self.videoComboBox.setEnabled(True)
self.audioComboBox.setEnabled(True)
self.recordPushButton.setIcon(QtGui.QIcon(os.path.join(scriptDir, 'rec_btn_off.svg')))
self.stopRecorder()
# =========================================================================
def checkEnableRecord(self):
if self.videoComboBox.currentIndex() and \
#.........这里部分代码省略.........