2
2
from PIL import ImageTk , Image
3
3
import os
4
4
5
+
5
6
def rotate_image ():
6
7
global counter
7
- img_label .config (image = img_array [counter % len (img_array )])
8
+ img_label .config (image = img_array [counter % len (img_array )])
8
9
counter = counter + 1
10
+
11
+
9
12
counter = 1
10
13
root = Tk ()
11
14
root .title ('Wallpaper viewer' )
12
- root .minsize (250 ,400 )
15
+ root .minsize (250 ,400 )
13
16
root .configure (background = 'black' )
14
- #img = Image.open('wallpaper/Screenshot_20210215-182223_Truecaller.jpg')
17
+ #img = Image.open('wallpaper/Screenshot_20210215-182223_Truecaller.jpg')
15
18
files = os .listdir (r'.\wallpaper' )
16
- #files = os.listdir('.')
17
- img_array = []
19
+ #files = os.listdir('.')
20
+ img_array = []
18
21
for file in files :
19
- img = Image .open (os .path .join (r'.\wallpaper' ,file ))
20
- resized_img = img .resize ((250 ,300 ))
22
+ img = Image .open (os .path .join (r'.\wallpaper' ,file ))
23
+ resized_img = img .resize ((250 ,300 ))
21
24
img_array .append (ImageTk .PhotoImage (resized_img ))
22
- img_label = Label (root ,image = img_array [0 ])
23
- img_label .pack (pady = (15 ,10 ))
25
+ img_label = Label (root ,image = img_array [0 ])
26
+ img_label .pack (pady = (15 ,10 ))
24
27
25
- next_btn = Button (root ,text = 'Next' , bg = 'white' , fg = 'black' , width = 25 , height = 2 , command = rotate_image )
28
+ next_btn = Button (root , text = 'Next' , bg = 'white' , fg = 'black' ,
29
+ width = 25 , height = 2 , command = rotate_image )
26
30
27
31
28
32
next_btn .pack ()
29
- root .mainloop ()
33
+ root .mainloop ()
0 commit comments