Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit f52e116

Browse files
Merge pull request avinashkranjan#2036 from Kalivarapubindusree/wall
Changing_Wall_Paper using GUI Added
2 parents 086f944 + 0fa329e commit f52e116

File tree

2 files changed

+79
-0
lines changed

2 files changed

+79
-0
lines changed
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# import modules
2+
from tkinter import *
3+
from tkinter import filedialog
4+
from wallpaper import set_wallpaper
5+
6+
# user define function
7+
def change_wall():
8+
9+
# set your photo
10+
try:
11+
set_wallpaper(str(path.get()))
12+
check = "success"
13+
14+
except:
15+
16+
check = "Wallpaper not found !"
17+
result.set(check)
18+
19+
20+
def browseFiles():
21+
filename = filedialog.askopenfilename(initialdir="/",
22+
title="Select a File",
23+
filetypes=(("jpeg files", "*.jpg"), ("all files", "*.*")))
24+
path.set(filename)
25+
26+
# Change label contents
27+
label_file_explorer.configure(text="File Opened: "+filename)
28+
return filename
29+
30+
31+
# object of tkinter
32+
# and background set for red
33+
master = Tk()
34+
master.configure(bg='light grey')
35+
36+
# Variable Classes in tkinter
37+
result = StringVar()
38+
path = StringVar()
39+
40+
41+
label_file_explorer = Label(
42+
master, text="Select a image", width=100, fg="blue")
43+
44+
45+
# Creating label for each information
46+
# name using widget Label
47+
Label(master, text="Select image : ", bg="light grey").grid(row=0, sticky=W)
48+
Label(master, text="Status :", bg="light grey").grid(row=3, sticky=W)
49+
50+
51+
# Creating label for class variable
52+
# name using widget Entry
53+
Label(master, text="", textvariable=result,
54+
bg="light grey").grid(row=3, column=1, sticky=W)
55+
56+
# creating a button using the widget
57+
# Button that will call the submit function
58+
b = Button(master, text="Open", command=browseFiles, bg="white")
59+
b.grid(row=0, column=2, columnspan=2, rowspan=2, padx=5, pady=5,)
60+
61+
label_file_explorer.grid(column=1, row=1)
62+
63+
c = Button(master, text="Apply", command=change_wall, bg="white")
64+
c.grid(row=2, column=2, columnspan=2, rowspan=2, padx=5, pady=5,)
65+
66+
mainloop()
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
**Changing_Wall_Paper **
2+
3+
4+
5+
**How to Use:**
6+
This Script is an Changing_Wall_Paper before that we need to import py-wallpaper (pip install py-wallpaper)Then just we need to run Changing_Wall_Paper.py simple and easy to use. And make sure You have given the right image file path!
7+
8+
9+
**conclusion:**
10+
11+
This Just a Script That we can allow to Changing_Wall_Paper photos from the script!
12+
13+
#### By [Kalivarapubindusree]()

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /