本文整理汇总了Python中music.Music.connect方法的典型用法代码示例。如果您正苦于以下问题:Python Music.connect方法的具体用法?Python Music.connect怎么用?Python Music.connect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类music.Music
的用法示例。
在下文中一共展示了Music.connect方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Display
# 需要导入模块: from music import Music [as 别名]
# 或者: from music.Music import connect [as 别名]
if __name__ == '__main__':
gobject.threads_init()
display = Display()
controller = Controller()
music = Music()
mainloop = gobject.MainLoop()
# Connect signals between components.
controller.connect('change-mode', display.change_mode)
controller.connect('station-up', music.tune_station, 1)
controller.connect('station-down', music.tune_station, -1)
controller.connect('play-pause', music.play_pause)
controller.connect('next-song', music.skip_song)
music.connect('station-changed', display.change_station)
music.connect('song-changed', display.change_song)
music.connect('state-changed', display.change_state)
# Start user interface loop.
display_thread = threading.Thread(target=display.run, args=(mainloop,))
display_thread.daemon = True
display_thread.start()
# Start radio streaming thread.
music_thread = threading.Thread(target=music.run, args=(mainloop,))
music_thread.daemon = True
music_thread.start()
# Start GPIO controller thread.
controller_thread = threading.Thread(target=controller.run, args=(mainloop,))