Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import wx
- import os
- import shutil
- import time
- class Window(wx.Frame):
- def __init__(self, parent, id):
- self.Desktop = "C:/Users/Name/Desktop/" and "C:/Users/Public/Desktop/"
- self.Dfiles = "C:/ Desktop_Files/"
- no_caption = wx.DEFAULT_FRAME_STYLE | wx.STAY_ON_TOP
- wx.Frame.__init__(self, parent, id, title="no_caption", size=(300,97), style=no_caption)
- self.panel=wx.Panel(self)
- self.Butt_Clear = wx.Button(self.panel, -1, label="Clear Desktop", pos=(0,0), size=(100,70))
- self.Butt_Clear.Bind(wx.EVT_BUTTON, self.ClearDesk, self.Butt_Clear)
- self.Butt_Undo = wx.Button(self.panel, -1, label="Undo Clear", pos=(185,0), size=(100,70))
- self.Butt_Undo.Bind(wx.EVT_BUTTON, self.UndoClear, self.Butt_Undo)
- def ClearDesk(self, e):
- MainDesktop = os.listdir(self.Desktop)
- MainDesktop.remove('desktop.ini')
- for Desktop_Path_Names in MainDesktop:
- Desktop_Path = os.path.join(self.Desktop, Desktop_Path_Names)
- shutil.move(Desktop_Path, self.Dfiles)
- def UndoClear(self, e):
- Dfolder = os.listdir(self.Dfiles)
- Dfolder.remove('desktop.ini')
- for Desktop_Folder_Path_Names in Dfolder:
- Dfolder_Path = os.path.join(self.Dfiles, Desktop_Folder_Path_Names)
- shutil.move(Dfolder_Path, self.Desktop)
- if __name__=='__main__':
- app=wx.App(False)
- frame=Window(parent=None, id=-1)
- frame.Show()
- app.MainLoop()
Advertisement
Add Comment
Please, Sign In to add comment