-
Notifications
You must be signed in to change notification settings - Fork 0
/
viewer.py
71 lines (45 loc) · 2.25 KB
/
viewer.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
from tkinter import *
from PIL import ImageTk, Image
root = Tk()
root.iconbitmap('G:\Projects\GUI\Icons\matrix.ico')
my_img1 = ImageTk.PhotoImage(Image.open("G:\Projects\GUI\Images\picture 1.jpg"))
my_img2 = ImageTk.PhotoImage(Image.open("G:\Projects\GUI\Images\picture 2.jpg"))
my_img3 = ImageTk.PhotoImage(Image.open("G:\Projects\GUI\Images\picture 3.jpg"))
my_img4 = ImageTk.PhotoImage(Image.open("G:\Projects\GUI\Images\picture 4.jpg"))
my_img5 = ImageTk.PhotoImage(Image.open("G:\Projects\GUI\Images\picture 5.jpg"))
image_list = [my_img1, my_img2, my_img3, my_img4, my_img5]
my_lable = Label(image = my_img1)
my_lable.grid(row = 0, column = 0, columnspan = 3)
def forward(image_number):
global my_lable
global button_next
global button_back
my_lable.grid_forget()
my_lable = Label(image = image_list[image_number - 1])
button_next = Button(root, text = ">>", command = lambda: forward(image_number + 1))
button_back = Button(root, text = "<<", command = lambda: backward(image_number - 1))
if image_number == 5:
button_next = Button(root, text = ">>", state = DISABLED)
my_lable.grid(row = 0, column = 0, columnspan = 3)
button_back.grid(row = 1, column = 0)
button_next.grid(row = 1, column = 2)
def backward(image_number):
global my_lable
global button_next
global button_back
my_lable.grid_forget()
my_lable = Label(image = image_list[image_number - 1])
button_next = Button(root, text = ">>", command = lambda: forward(image_number + 1))
button_back = Button(root, text = "<<", command = lambda: backward(image_number - 1))
if image_number == 1:
button_back = Button(root, text = "<<", state = DISABLED)
my_lable.grid(row = 0, column = 0, columnspan = 3)
button_back.grid(row = 1, column = 0)
button_next.grid(row = 1, column = 2)
button_back = Button(root, text = '<<', command = backward, state = DISABLED)
button_next = Button(root, text = '>>', command = lambda: forward(2))
button_quit = Button(root, text = 'Quit', command = root.quit)
button_back.grid(row = 1, column = 0)
button_quit.grid(row = 1, column = 1)
button_next.grid(row = 1, column = 2)
root.mainloop()