Advertisement
mburton2

Change Desktop

Jan 6th, 2018
190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.91 KB | None | 0 0
  1. import wx
  2. import os
  3. import shutil
  4. import ctypes
  5. import itertools
  6.  
  7.  
  8. class Window(wx.Frame):
  9.     def __init__(self, parent, id):
  10.         self.dPics = "C:\\Desktop background\\Digital"
  11.         self.AnimePics = "C:\\Desktop background\\anime"
  12.         self.DigitalPics = "C:\\Desktop background\\Digital"
  13.         self.LandscapePics = "C:\\Desktop background\\Landscape"
  14.         self.StreetBluesPics = "C:\\Desktop background\\StreetBlues"
  15.         self.DigiList = []
  16.         self.AniList = []
  17.         self.LanList = []
  18.         self.SPI_SETDESKWALLPAPER = 20
  19.         no_caption = wx.DEFAULT_FRAME_STYLE | wx.STAY_ON_TOP
  20.         wx.Frame.__init__(
  21.             self, parent, id, title="Change Background",
  22.             size=(300, 105), style=no_caption)
  23.         self.panel = wx.Panel(self)
  24.         self.panel.SetTransparent(0)
  25.         self.cBack = wx.Button(
  26.             self.panel, -1, label="Digital",
  27.             pos=(0, 0), size=(100, 70))
  28.         self.cBack.Bind(wx.EVT_BUTTON, self.Digital, self.cBack)
  29.         self.Butt_Undo = wx.Button(
  30.             self.panel, -1, label="Anime",
  31.             pos=(200, 0), size=(100, 70))
  32.         self.Butt_Undo.Bind(wx.EVT_BUTTON, self.Anime, self.Butt_Undo)
  33.         self.Butt_Dups = wx.Button(
  34.             self.panel, -1, label="Landscape",
  35.             pos=(100, 0), size=(100, 70))
  36.         self.Butt_Dups.Bind(wx.EVT_BUTTON, self.Landscape, self.Butt_Dups)
  37.         self.dPicsFull = os.listdir(self.dPics)
  38.         self.AnPics = os.listdir(self.AnimePics)
  39.         self.LanPics = os.listdir(self.LandscapePics)
  40.         self.DigPics = os.listdir(self.DigitalPics)
  41.         for items in self.dPicsFull:
  42.             DigiPath = os.path.join(self.dPics, items)
  43.             if DigiPath.endswith(('.jpg', '.png')):
  44.                 self.DigiList.append(DigiPath)
  45.  
  46.         for items1 in self.AnPics:
  47.             AniPath = os.path.join(self.AnimePics, items1)
  48.             if AniPath.endswith(('.jpg', '.png')):
  49.                 self.AniList.append(AniPath)
  50.  
  51.         for items2 in self.LanPics:
  52.             LanPath = os.path.join(self.LandscapePics, items2)
  53.             if LanPath.endswith(('.jpg', '.png')):
  54.                 self.LanList.append(LanPath)
  55.  
  56.         self.DigiImages = itertools.cycle(self.DigiList)
  57.         self.AniImages = itertools.cycle(self.AniList)
  58.         self.LanImages = itertools.cycle(self.LanList)
  59.  
  60.     def Digital(self, e):
  61.         ctypes.windll.user32.SystemParametersInfoA(
  62.             self.SPI_SETDESKWALLPAPER, 0, next(self.DigiImages), 3)
  63.  
  64.     def Anime(self, e):
  65.         ctypes.windll.user32.SystemParametersInfoA(
  66.             self.SPI_SETDESKWALLPAPER, 0, next(self.AniImages), 3)
  67.  
  68.     def Landscape(self, e):
  69.         ctypes.windll.user32.SystemParametersInfoA(
  70.             self.SPI_SETDESKWALLPAPER, 0, next(self.LanImages), 3)
  71.  
  72. if __name__ == '__main__':
  73.     app = wx.App(False)
  74.     frame = Window(parent=None, id=-1)
  75.     frame.Show()
  76.     app.MainLoop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement