def onSnapshot(self, evt): s = Snapshot(self, self.settings) if s.wasSuccessful(): s.Show() else: dlg = wx.MessageDialog(self, "Error Taking Picture", 'Camera Error', wx.OK | wx.ICON_ERROR) dlg.ShowModal() dlg.Destroy()