#! /usr/bin/env python import os from gi.repository import Gtk scriptdir = os.path.dirname(os.path.abspath(__file__)) class SyncGui: def __init__(self): self.builder = Gtk.Builder() self.builder.add_from_file(scriptdir + "/sync_gui.glade") self.position = self.builder.get_object("Position") self.btnPause = self.builder.get_object("Pause") self.btnPlay = self.builder.get_object("Play") self.status = self.builder.get_object("Status") handlers = { "onDestroy": self.onDestroy, "onPrevious": self.onPrevious, "onBackward": self.onBackward, "onStop": self.onStop, "onPause": self.onPause, "onPlay": self.onPlay, "onForward": self.onForward, "onNext": self.onNext, } self.builder.connect_signals(handlers) self.status.push(0, "TODO...") def onDestroy(self, widget): Gtk.main_quit() def onPrevious(self, widget): print("previous") def onBackward(self, widget): print("backward") def onStop(self, widget): print("stop") self.btnPause.set_visible(False) self.btnPlay.set_visible(True) def onPause(self, widget): print("pause") self.btnPause.set_visible(False) self.btnPlay.set_visible(True) def onPlay(self, widget): print("play") self.btnPause.set_visible(True) self.btnPlay.set_visible(False) def onForward(self, widget): print("forward") def onNext(self, widget): print("next") if __name__ == "__main__": app = SyncGui() Gtk.main()