Python 3 Tkinter Script to Change Windows Desktop Wallpaper With Custom Image GUI Desktop App
103 views
Jun 3, 2025
Get the full source code of application here: https://codingshiksha.com/python/python-3-tkinter-script-to-change-windows-desktop-wallpaper-with-custom-image-gui-desktop-app/
View Video Transcript
0:00
uh hello guys welcome to this video so
0:02
in this video I will show you a Python
0:04
script which will manage your wallpaper
0:06
inside your Windows machine so it
0:08
specifically works with Windows so I
0:10
basically built out this Twinter GUI
0:13
desktop app uh which you launch it looks
0:16
something like this so here you can
0:18
select custom image and uh from your
0:20
computer and set wallpaper and you can
0:23
even remove that as well by restoring
0:25
the original wallpaper as well so we
0:26
have these three buttons so now if I
0:28
click the first button I will be able to
0:31
select any custom image and simply
0:34
select this image and now you will see
0:35
the wallpaper will be changed
0:38
instantly so very simple application you
0:40
select your image and then if you want
0:43
to restore the original wallpaper you
0:45
simply click restore and now your
0:48
original wallpaper will be restored if I
0:50
select again this custom image you will
0:53
see the wallpaper will change if I close
0:55
this application it will stay you will
0:57
see that so in this easy way you can
1:00
customize your desktop wallpaper very
1:02
easily using this Twinter GOI desktop
1:05
app if you again want to restore you
1:09
simply click the restore button and you
1:12
can see that you can basically set
1:15
any desktop
1:19
wallpaper as you can see
1:26
so I will show you this application uh
1:28
the full script is given in the
1:30
description of this video so if you need
1:32
the full script you can go to my website
1:34
and copy paste all the full script so
1:37
now let me show you how I build this so
1:39
first of all we will import all the
1:41
packages so we are using Twinter package
1:45
so we import all these
1:47
packages so I will simply paste to
1:51
import all these packages as you can see
1:53
we are also using pillow library which
1:55
manages your images and then we set some
1:58
constants which are required here for
2:02
this desktop wallpaper application so we
2:05
set these constants the folder in which
2:07
your wallpaper folder inside your
2:11
current working directory we create this
2:13
folder wallpaper changer and we make
2:15
these directories automatically so after
2:18
that we
2:20
simply need to have the BMP files
2:24
because by default Windows wallpapers
2:26
need to be inside BMP
2:29
extension so we do
2:32
this the default
2:35
BMP we'll have the original name
2:38
original wallpaper backup and temp
2:40
wallpaper we're creating this temp
2:43
directory so just paste this code and
2:45
after that we will come to the GUI
2:48
application we will initialize
2:51
here this uh title of the window which
2:54
is wallpaper changer 360x 200 and it
2:58
will not be
3:00
resizable and now to start this
3:02
application you simply call main loop so
3:06
once you start this application it will
3:08
look something like this you can see
3:10
that and now we just need to add some
3:13
widgets on the screen so first of all I
3:16
will add a simple label which will
3:18
simply say
3:20
desktop wallpaper changer simply paste
3:23
it and then we simply add these three
3:26
buttons which will be responsible
3:29
for select image and set wallpaper
3:32
restore original wallpaper and exit so
3:35
now we define these three commands these
3:37
three functions which will be there the
3:39
first will be responsible for browsing
3:41
the custom image inside your computer
3:44
restoring default wallpaper and
3:46
quit so just we need to define these
3:49
functions so if you want to
3:53
restore
3:54
restore default
3:58
wallpaper so inside this function it's
4:00
very easy so if the path
4:04
exist of the
4:06
default BMP then we just need to remove
4:10
it for removing it you set the
4:14
wallpaper set wallpaper which is the
4:18
default DMP and then simply say in a
4:22
message box that
4:27
uh reverted original wallpaper restored
4:32
successfully that's all is
4:36
there and then we will basically make
4:40
this function which is browse image
4:43
which will be respons responsible once
4:46
you click the select image button so
4:49
then you will be able to select from a
4:51
file
4:55
dialogue so here you will be accepting
4:59
only image
5:02
files so if file path
5:10
So like this uh so this is a whole
5:13
function right here let me just paste it
5:17
this is only responsible for
5:21
setting for selecting the custom image
5:24
so browse image function so here we are
5:27
setting the wallpaper as you can see and
5:29
uh for setting we just need to convert
5:32
the image
5:34
to BMP because all the desktop wallpaper
5:38
images in Windows needs to be in this
5:40
format so we just need to convert your
5:42
JPG or PNG image to this format which is
5:45
BMP so we are doing this by using the
5:48
pillow library we opening this input
5:51
image and converting this to BMP and
5:53
then setting the wallpaper so this
5:56
completes your application
6:00
and we do need to actually uh define
6:03
this function which is set wallpaper
6:05
which will actually set the wallpaper
6:07
for you so this is again a function set
6:10
wallpaper we take the actual image and
6:13
then we simply call this C types wind DL
6:17
user 32 system parameters info and this
6:21
will set the wallpaper as your text
6:23
wallpaper and if you want to get the
6:26
current wallpaper so this is only
6:28
applicable for Windows to get the
6:31
current wallpaper we execute this three
6:34
lines of code so this will get the
6:36
existing
6:37
wallpaper like this so this completes
6:40
your application and if I launch this
6:45
application the full script guys is
6:47
given in the description
6:50
so it's a little bit complicated because
6:52
it involves setting and changing
6:54
wallpaper inside Windows
6:56
machine so once again we have three
6:58
buttons you can select any
7:05
image and see wallpaper changed
7:09
successfully if you want to revert to
7:11
original you can see
7:13
that all the things are happening so you
7:16
can manage your wallpapers very easily
7:18
guys with this app if you can't directly
7:21
change your wallpaper you can use this
7:23
Python script to do this the full script
7:26
is given in the description of the video
7:28
uh thank you very much guys for watching
7:30
this video please hit that like button
7:32
subscribe the channel and also visit my
7:36
website which is
7:37
freemediatools.com uh which contains
7:40
thousands of tools
#Online Goodies
#Skins
# Themes & Wallpapers