Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import wx
- import os
- import shutil
- import ctypes
- import itertools
- class Window(wx.Frame):
- def __init__(self, parent, id):
- self.dPics = "C:\\Desktop background\\Digital"
- self.AnimePics = "C:\\Desktop background\\anime"
- self.DigitalPics = "C:\\Desktop background\\Digital"
- self.LandscapePics = "C:\\Desktop background\\Landscape"
- self.StreetBluesPics = "C:\\Desktop background\\StreetBlues"
- self.DigiList = []
- self.AniList = []
- self.LanList = []
- self.SPI_SETDESKWALLPAPER = 20
- no_caption = wx.DEFAULT_FRAME_STYLE | wx.STAY_ON_TOP
- wx.Frame.__init__(
- self, parent, id, title="Change Background",
- size=(300, 105), style=no_caption)
- self.panel = wx.Panel(self)
- self.panel.SetTransparent(0)
- self.cBack = wx.Button(
- self.panel, -1, label="Digital",
- pos=(0, 0), size=(100, 70))
- self.cBack.Bind(wx.EVT_BUTTON, self.Digital, self.cBack)
- self.Butt_Undo = wx.Button(
- self.panel, -1, label="Anime",
- pos=(200, 0), size=(100, 70))
- self.Butt_Undo.Bind(wx.EVT_BUTTON, self.Anime, self.Butt_Undo)
- self.Butt_Dups = wx.Button(
- self.panel, -1, label="Landscape",
- pos=(100, 0), size=(100, 70))
- self.Butt_Dups.Bind(wx.EVT_BUTTON, self.Landscape, self.Butt_Dups)
- self.dPicsFull = os.listdir(self.dPics)
- self.AnPics = os.listdir(self.AnimePics)
- self.LanPics = os.listdir(self.LandscapePics)
- self.DigPics = os.listdir(self.DigitalPics)
- for items in self.dPicsFull:
- DigiPath = os.path.join(self.dPics, items)
- if DigiPath.endswith(('.jpg', '.png')):
- self.DigiList.append(DigiPath)
- for items1 in self.AnPics:
- AniPath = os.path.join(self.AnimePics, items1)
- if AniPath.endswith(('.jpg', '.png')):
- self.AniList.append(AniPath)
- for items2 in self.LanPics:
- LanPath = os.path.join(self.LandscapePics, items2)
- if LanPath.endswith(('.jpg', '.png')):
- self.LanList.append(LanPath)
- self.DigiImages = itertools.cycle(self.DigiList)
- self.AniImages = itertools.cycle(self.AniList)
- self.LanImages = itertools.cycle(self.LanList)
- def Digital(self, e):
- ctypes.windll.user32.SystemParametersInfoA(
- self.SPI_SETDESKWALLPAPER, 0, next(self.DigiImages), 3)
- def Anime(self, e):
- ctypes.windll.user32.SystemParametersInfoA(
- self.SPI_SETDESKWALLPAPER, 0, next(self.AniImages), 3)
- def Landscape(self, e):
- ctypes.windll.user32.SystemParametersInfoA(
- self.SPI_SETDESKWALLPAPER, 0, next(self.LanImages), 3)
- 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
Advertisement