Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import wx
- import os
- import shutil
- import ctypes
- class Window(wx.Frame):
- def __init__(self, parent, id):
- self.dPics = "C:\Desktop background"
- self.list = []
- self.SPI_SETDESKWALLPAPER = 20
- no_caption = wx.DEFAULT_FRAME_STYLE | wx.STAY_ON_TOP
- wx.Frame.__init__(
- self, parent, id, title="no_caption",
- size=(300, 105), style=no_caption)
- self.panel = wx.Panel(self)
- self.cBack = wx.Button(
- self.panel, -1, label="Change",
- pos=(0, 0), size=(100, 70))
- self.cBack.Bind(wx.EVT_BUTTON, self.ChangeDesk, self.cBack)
- self.dPicsFull = os.listdir(self.dPics)
- self.counter = 0
- for self.items in self.dPicsFull:
- self.fullPath = os.path.join(self.dPics, self.items)
- if self.fullPath.endswith(('.jpg', '.png')):
- self.list.append(self.fullPath)
- def ChangeDesk(self, e):
- ctypes.windll.user32.SystemParametersInfoA(
- self.SPI_SETDESKWALLPAPER, 0, self.list[self.counter], 3)
- self.counter += 1
- if self.list[self.counter] == self.list[-1]:
- self.counter = 0
- 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