-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdisplayamember.py
More file actions
59 lines (40 loc) · 1.32 KB
/
Copy pathdisplayamember.py
File metadata and controls
59 lines (40 loc) · 1.32 KB
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
import tkinter as tk
file_paths = open("your_path/name.txt","r")
file_paths_list1 = file_paths.readlines()
file_paths_list = []
for i in file_paths_list1:
j = i.strip("\n")
print(j)
file_paths_list.append(j)
root1 = tk.Tk()
root1.geometry("400x400")
displaymembvar = tk.StringVar()
def displayb():
dd='.txt'
hh=file_paths_list[0] + "/"
displaymemb = displaymembvar.get()
gg=hh+displaymemb+dd
main1 = tk.Tk()
try:
pp=open(gg,'r')
xx=pp.read()
pp.close()
msg = xx
msgvar = tk.Message(main1, text = msg)
msgvar.pack()
main1.attributes('-topmost',True)
main1.mainloop()
except:
msg2 = "No such book found."
msg2var = tk.Label(main1, text = msg2)
msg2var.pack()
main1.attributes('-topmost',True)
main1.mainloop()
membsearch_label = tk.Label(root1, text = 'Name', font = ('calibre', 10, 'bold'))
membsearch_entry = tk.Entry(root1, textvariable = displaymembvar, font = ('calibre', 10, 'normal'))
srch_btn = tk.Button(root1, text = "Search", command = displayb)
membsearch_label.grid(row=0,column=0)
membsearch_entry.grid(row=0,column=1)
srch_btn.grid(row=1,column=1)
root1.attributes('-topmost',True)
root1.mainloop()