class MainApp(Tkinter.Frame): def __init__(self, master=None, config=None, logger = None): Tkinter.Frame.__init__(self, master) self.pack() self.root = master self._config = config or {} self.log = logger or Logging.getLogger(self.__class__.__name__) if self.log.isEnabledFor('debug'): self.log.logBlock('debug', pformat(self._config)) self.showImage() #self.showMpd() def showImage(self): self.log.debug('---> showImage called') self.mpdStatus = MpdStatus(self._config, logger = self.log) self.imageFrame = ShowImageApp(self, config = self._config, onQuit = self.quitImage, statusFunc = self.mpdStatus.printStatus) #self.root.protocol("WM_DELETE_WINDOW", self.quitImage) def quitImage(self, event = None): self.log.debug('---> quitImage called') self.imageFrame.destroy() self.mpdStatus.destroy() self.imageFrame = None self.mpdStatus = None self.showMpd() def showMpd(self): self.log.debug('---> showMpd called') self.mpdFrame = MpdControl (self, config = self._config, onQuit = self.quitMpd) #self.mpdFrame.protocol("WM_DELETE_WINDOW", self.quitMpd) def quitMpd(self, event = None): self.log.debug('---> quitMpd called') self.mpdFrame.destroy() self.mpdFrame = None self.showImage()
def showImage(self): self.log.debug('---> showImage called') self.mpdStatus = MpdStatus(self._config, logger = self.log) self.imageFrame = ShowImageApp(self, config = self._config, onQuit = self.quitImage, statusFunc = self.mpdStatus.printStatus)