diff --git a/music_folder/.tmp/cover.png b/music_folder/.tmp/cover.png index 1b1c8d6..76ec7f7 100644 Binary files a/music_folder/.tmp/cover.png and b/music_folder/.tmp/cover.png differ diff --git a/musicplayer.py b/musicplayer.py index e6ed450..8b713e0 100644 --- a/musicplayer.py +++ b/musicplayer.py @@ -72,20 +72,12 @@ class MainFrame(wx.Frame): self.music = pygame.mixer.music self.SONG_FINISHED = pygame.USEREVENT + 1 - if hasattr(sys, "frozen") and getattr(sys, "frozen") == "windows_exe": - exeName = win32api.GetModuleFileName(win32api.GetModuleHandle(None)) - icon = wx.Icon(exeName, wx.BITMAP_TYPE_ANY) - else : - icon = wx.Icon('resources/music.png', wx.BITMAP_TYPE_ANY) - self.SetIcon(icon) # 以下可以添加各类控件 - pass - - ''' # 下载音乐面板 - self.down_music_panel = None - self.input_url_text_ctrl = None # 输入的下载路径 - self.down_button = None # 下载按钮 - self.draw_down_music_panel()''' + icon = wx.Icon('resources/music.png', wx.BITMAP_TYPE_ANY) + self.SetIcon(icon) + + self.Bind(wx.EVT_CLOSE, self.OnClose) + def get_path_by_name(self, file_name): ''' @@ -426,6 +418,13 @@ class MainFrame(wx.Frame): #filename = self.current_music_name+'.png' with open(write_path, 'wb') as img: img.write(cover) + + def OnClose(self, evt): + '''关闭窗口事件函数''' + dlg = wx.MessageDialog(None, u'确定要关闭本窗口?', u'操作提示', wx.YES_NO | wx.ICON_QUESTION) + if(dlg.ShowModal() == wx.ID_YES): + self.Destroy() + self.music.stop() if __name__ == "__main__": @@ -433,4 +432,4 @@ if __name__ == "__main__": frame = MainFrame() frame.Show(True) app.MainLoop() - wx.Exit() \ No newline at end of file + #wx.Exit() \ No newline at end of file