首页
学习
活动
专区
圈层
工具
发布
    • 综合排序
    • 最热优先
    • 最新优先
    时间不限
  • 来自专栏python全栈教程专栏

    【深度讲解】手把手教你python制作萝莉音智能对话语音机器人,附全部源码!速速学起来!!

    from sys import getfilesystemencoding elif operating_system == 'Darwin': from AppKit import NSSound '/' + sound sound = 'file://' + sound url = NSURL.URLWithString_(sound) nssound = NSSound.alloc().initWithContentsOfURL_byReference_(url, True) if not nssound: raise IOError('Unable to load sound named: ' + sound) nssound.play() if block: sleep(nssound.duration()) def stop(self): raise NotImplemented class playsoundNix(playsoundBase

    1.6K20发布于 2021-10-19
  • 来自专栏一“技”之长

    OS X开发:NSButton按钮控件应用 原

    设置是否当鼠标移动到按钮上时显示边框 @property BOOL showsBorderOnlyWhileMouseInside; //设置按钮声音 @property (nullable, strong) NSSound

    1.6K20发布于 2018-08-15
  • 来自专栏Swift社区

    SwiftUI 动画进阶 — Part4:TimelineView

    最后一段与 SwiftUI 无关的代码是创建 NSSound 实例。为了避免使示例过于复杂,笔者创建了几个全局变量: let bellSound: NSSound? let url = Bundle.main.url(forResource: "bell", withExtension: "mp3") else { return nil } return NSSound (contentsOf: url, byReference: true) }() let beatSound: NSSound? let url = Bundle.main.url(forResource: "beat", withExtension: "mp3") else { return nil } return NSSound

    4.5K30编辑于 2022-04-04
领券