本文整理汇总了Python中AppKit.NSSound.soundNamed_方法的典型用法代码示例。如果您正苦于以下问题:Python NSSound.soundNamed_方法的具体用法?Python NSSound.soundNamed_怎么用?Python NSSound.soundNamed_使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AppKit.NSSound
的用法示例。
在下文中一共展示了NSSound.soundNamed_方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: executeCapture
# 需要导入模块: from AppKit import NSSound [as 别名]
# 或者: from AppKit.NSSound import soundNamed_ [as 别名]
def executeCapture(self):
self.photoView.setHidden_(False)
self.captureView.setHidden_(True)
self.previewButton.setHidden_(False)
self.countdownCheckbox.setHidden_(True)
self.captureButton.setHidden_(True)
self.useButton.setEnabled_(True)
if self.captureSession is not None:
self.captureImage()
NSSound.soundNamed_("Grab").play()
self.captureSession.stopRunning()
示例2: executeTimerCapture_
# 需要导入模块: from AppKit import NSSound [as 别名]
# 或者: from AppKit.NSSound import soundNamed_ [as 别名]
def executeTimerCapture_(self, timer):
if self.countdown_counter == 1:
self.executeCapture()
self.countdownProgress.stopAnimation_(None)
self.countdownCheckbox.setHidden_(True)
self.countdownProgress.setHidden_(True)
self.timer.invalidate()
self.timer = None
else:
self.countdown_counter = self.countdown_counter - 1
NSSound.soundNamed_("Tink").play()
self.countdownProgress.setDoubleValue_(self.countdown_counter)
示例3: present
# 需要导入模块: from AppKit import NSSound [as 别名]
# 或者: from AppKit.NSSound import soundNamed_ [as 别名]
def present(self):
"""Present the Alert, giving up after configured time..
Returns: Int result code, based on PyObjC enums. See NSAlert
Class reference, but result should be one of:
User clicked the cancel button:
NSAlertFirstButtonReturn = 1000
Alert timed out:
NSRunAbortedResponse = -1001
"""
if self.timer:
NSRunLoop.currentRunLoop().addTimer_forMode_(self.timer, NSModalPanelRunLoopMode)
# Start a Cocoa application by getting the shared app object.
# Make the python app the active app so alert is noticed.
app = NSApplication.sharedApplication()
app.activateIgnoringOtherApps_(True)
if self.alert_sound:
sound = NSSound.soundNamed_(self.alert_sound).play()
result = self.runModal() # pylint: disable=no-member
print result
return result