mburton2

Untitled

Aug 14th, 2017
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.62 KB | None | 0 0
  1. import wx
  2. import os
  3. import shutil
  4. import time
  5.  
  6. class Window(wx.Frame):
  7.     def __init__(self, parent, id):
  8.         self.Desktop = "C:/Users/Name/Desktop/" and "C:/Users/Public/Desktop/"
  9.         self.Dfiles = "C:/ Desktop_Files/"                
  10.         no_caption = wx.DEFAULT_FRAME_STYLE | wx.STAY_ON_TOP
  11.         wx.Frame.__init__(self, parent, id, title="no_caption", size=(300,97), style=no_caption)            
  12.         self.panel=wx.Panel(self)
  13.         self.Butt_Clear = wx.Button(self.panel, -1, label="Clear Desktop", pos=(0,0), size=(100,70))
  14.         self.Butt_Clear.Bind(wx.EVT_BUTTON, self.ClearDesk, self.Butt_Clear)
  15.         self.Butt_Undo = wx.Button(self.panel, -1, label="Undo Clear", pos=(185,0), size=(100,70))
  16.         self.Butt_Undo.Bind(wx.EVT_BUTTON, self.UndoClear, self.Butt_Undo)                     
  17.     def ClearDesk(self, e):        
  18.         MainDesktop = os.listdir(self.Desktop)      
  19.         MainDesktop.remove('desktop.ini')
  20.        
  21.         for Desktop_Path_Names in MainDesktop: 
  22.             Desktop_Path = os.path.join(self.Desktop, Desktop_Path_Names)          
  23.             shutil.move(Desktop_Path, self.Dfiles)
  24.                                          
  25.     def UndoClear(self, e):
  26.         Dfolder = os.listdir(self.Dfiles)
  27.         Dfolder.remove('desktop.ini')
  28.         for Desktop_Folder_Path_Names in Dfolder:
  29.             Dfolder_Path = os.path.join(self.Dfiles, Desktop_Folder_Path_Names)
  30.             shutil.move(Dfolder_Path, self.Desktop)
  31.                
  32. if __name__=='__main__':
  33.     app=wx.App(False)
  34.     frame=Window(parent=None, id=-1)
  35.     frame.Show()
  36.     app.MainLoop()
Advertisement
Add Comment
Please, Sign In to add comment