-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathui_object.py
More file actions
682 lines (614 loc) · 27.9 KB
/
ui_object.py
File metadata and controls
682 lines (614 loc) · 27.9 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
# -*- coding:utf-8 -*-
from PIL import Image, ImageTk
from get_movie_data import moviedata
from get_movie_data import get_url_data_in_ranking_list
from get_movie_data import get_url_data_in_keyword
from tkinter import Tk
from tkinter import ttk
from tkinter import font
from tkinter import LabelFrame
from tkinter import Label
from tkinter import StringVar
from tkinter import Entry
from tkinter import END
from tkinter import Button
from tkinter import Frame
from tkinter import RIGHT
from tkinter import NSEW
from tkinter import NS
from tkinter import NW
from tkinter import N
from tkinter import Y
from tkinter import messagebox
from tkinter import DISABLED
from tkinter import NORMAL
from re import findall
from json import loads
from ssl import _create_unverified_context
from threading import Thread
from urllib.parse import quote
from webbrowser import open
import urllib
import os
import ssl
ssl._create_default_https_context = ssl._create_unverified_context # SSL blocked
# Maybe we should do UI frame design with PyQT, that's the solution for enterprise testing and development.
# Python API application, processing...Py-ML platform
def thread_it(func, *args):
'''
Packing functions into threads
'''
# create
t = Thread(target=func, args=args)
# daemon
t.setDaemon(True)
# start
t.start()
def handler_adaptor(fun, **kwds):
'''Adapters for event handling Functions'''
return lambda event, fun=fun, kwds=kwds: fun(event, **kwds)
def save_img(img_url, file_name, file_path):
"""
:param img_url:
:param file_name:
:param file_path:
:return:
"""
#default path
try:
# Determining whether a folder already exists
if not os.path.exists(file_path):
print('Folder',file_path,'not exist, rebuild.')
os.makedirs(file_path)
# Get file suffix
file_suffix = os.path.splitext(img_url)[1]
# Splice image name, include path
filename = '{}{}{}{}'.format(file_path,os.sep,file_name,file_suffix)
# Determining whether a folder already exists
if not os.path.exists(filename):
print('document', filename, 'not exist, rebuild.')
# Download and save images
urllib.request.urlretrieve(img_url, filename=filename)
return filename
except IOError as e:
print('Fail to download images',e)
except Exception as e:
print('Error:',e)
def resize(w_box, h_box, pil_image):
"""
Scale the image proportionally and limit it to the specified box.
:param w_box,h_box: specified box
:param pil_image: original image
:return:
"""
f1 = 1.0 * w_box / pil_image.size[0] # 1.0 forces float division in Python2
f2 = 1.0 * h_box / pil_image.size[1]
factor = min([f1, f2])
# print(f1, f2, factor) # test
# use best down-sizing filter
width = int(pil_image.size[0] * factor)
height = int(pil_image.size[1] * factor)
return pil_image.resize((width, height), Image.ANTIALIAS)
def get_mid_str(content, startStr, endStr):
startIndex = content.find(startStr, 0) # Locate the first character of the start string and start searching from the start position
if startIndex >= 0:
startIndex += len(startStr)
else:
return ""
end_index = content.find(endStr, startIndex) # To locate the end string, start from the beginning string.
if end_index >= 0 and end_index >= startIndex:
return content[startIndex:end_index]
else:
return ""
class ui_object:
def __init__(self):
self.jsondata = ""
self.jsondata_keyword = ""
def show_gui_movie_detail(self):
'''
Displaying film message and graphical user interface
'''
self.label_img['state'] = NORMAL
self.label_movie_name['state'] = NORMAL
self.label_movie_rating['state'] = NORMAL
self.label_movie_time['state'] = NORMAL
self.label_movie_type['state'] = NORMAL
self.label_movie_actor['state'] = NORMAL
def hidden_gui_movie_detail(self):
self.label_img['state'] = DISABLED
self.label_movie_name['state'] = DISABLED
self.label_movie_rating['state'] = DISABLED
self.label_movie_time['state'] = DISABLED
self.label_movie_type['state'] = DISABLED
self.label_movie_actor['state'] = DISABLED
def show_imdb_rating(self):
self.label_movie_rating_imdb.config(text='Loading ranking IMDb')
self.b_0_imdb['state'] = DISABLED
item = self.treeview.selection()
if item:
item_text = self.treeview.item(item, "values")
movie_name = item_text[0] # output movie_name
for movie in self.jsondata:
if movie['title'] == movie_name:
context = _create_unverified_context() # Blocking SSL
headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36'}
req = urllib.request.Request(url=movie['url'], headers=headers)
f = urllib.request.urlopen(req, context=context)
response = f.read().decode()
self.clear_tree(self.treeview_play_online)
s = response
name = findall(r'<a class="playBtn" data-cn="(.*?)" data-impression-track', s)
down_url = findall(r'data-cn=".*?" href="(.*?)" target=', s)
res_list = []
for i in range(len(name)):
res_list.append([name[i], "VIP blocked", down_url[i]])
self.add_tree(res_list, self.treeview_play_online)
self.clear_tree(self.treeview_save_cloud_disk)
res_list = []
res_list.append(["56网盘搜索", "Verified", "https://www.56wangpan.com/search/o2kw" + quote(movie['title'])])
res_list.append(["小白盘", "Verified", "https://www.xiaobaipan.com/list-" + quote(movie['title']) + "-1.html" ])
self.add_tree(res_list, self.treeview_save_cloud_disk)
self.clear_tree(self.treeview_bt_download)
res_list = []
res_list.append(['LOL电影', 'Verified', 'http://www.993dy.com/index.php?m=vod-search&wd=' + quote(movie['title'])])
res_list.append(['看美剧', 'Verified', 'http://www.kanmeiju.net/index.php?s=/video/search/wd/' + quote(movie['title'])])
res_list.append(['飘花资源网', 'Verified', 'https://www.piaohua.com/plus/search.php?kwtype=0&keyword=' + quote(movie['title'])])
res_list.append(['中国高清网', 'Verified', 'http://gaoqing.la/?s=' + quote(movie['title'])])
self.add_tree(res_list, self.treeview_bt_download)
imdb_num = get_mid_str(response, 'IMDb:</span>', '<br>').strip()
imdb_url = "https://www.imdb.com/title/{}/".format(imdb_num)
print("Film name:{}, IMDb:{}".format(movie['title'], imdb_num))
f = urllib.request.urlopen(imdb_url)
data_imdb = f.read().decode()
rating_imdb = get_mid_str(data_imdb, '{"@type":"AggregateRating"', '}')
rating_imdb = rating_imdb.split(":")[-1]
self.label_movie_rating_imdb.config(text='IMDb rate:' + rating_imdb + '')
self.b_0_imdb['state'] = NORMAL
def project_statement_get_focus(self, event):
self.project_statement.config(fg="blue", cursor="hand1")
def project_statement_lose_focus(self, event):
self.project_statement.config(fg="#FF0000")
def show_movie_data(self, event):
'''
Displaying details for a selected movie
'''
# self.hidden_gui_movie_detail()
self.b_0_imdb['state'] = NORMAL
self.label_movie_rating_imdb.config(text = 'IMDb rate:')
self.clear_tree(self.treeview_play_online)
self.clear_tree(self.treeview_save_cloud_disk)
self.clear_tree(self.treeview_bt_download)
item = self.treeview.selection()
if item:
item_text = self.treeview.item(item, "values")
movie_name = item_text[0] # output movie_name
for movie in self.jsondata:
if(movie['title'] == movie_name):
img_url = movie['cover_url']
movie_name = movie['title']
file_name = save_img(img_url, movie_name, 'img') # Download images
self.show_movie_img(file_name)
self.label_movie_name.config(text=movie['title'])
if(isinstance(movie['actors'],list)):
string_actors = "、".join(movie['actors'])
else:
string_actors = movie['actors']
self.label_movie_actor.config(text=string_actors)
self.label_movie_rating.config(text=str(movie['rating'][0]) + ' ' + str(movie['vote_count']) + 'rating')
self.label_movie_time.config(text=movie['release_date'])
self.label_movie_type.config(text=movie['types'])
break
# self.show_gui_movie_detail()
def show_movie_img(self, file_name):
'''
Refresh images
:param file_name: image path
:return:
'''
img_open = Image.open(file_name) # load local images
pil_image_resized = resize(160, 230, img_open) # proportionally scaling local images
img = ImageTk.PhotoImage(pil_image_resized) # pull images
self.label_img.config(image=img, width = pil_image_resized.size[0], height = pil_image_resized.size[1])
self.label_img.image = img
def center_window(self, root, w, h):
"""
Window centred
:param root: root
:param w: width
:param h: height
:return:
"""
# get the screen width and height
ws = root.winfo_screenwidth()
hs = root.winfo_screenheight()
# calculate x, y
x = (ws/2) - (w/2)
y = (hs/2) - (h/2)
root.geometry('%dx%d+%d+%d' % (w, h, x, y))
def clear_tree(self, tree):
'''
clean tables
'''
x = tree.get_children()
for item in x:
tree.delete(item)
def add_tree(self,list, tree):
'''
add data into tables
'''
i = 0
for subList in list:
tree.insert('', 'end', values=subList)
i = i + 1
tree.grid()
def searh_movie_in_rating(self):
self.clear_tree(self.treeview)
self.b_0['state'] = DISABLED
self.c_type['state'] = DISABLED
self.t_count['state'] = DISABLED
self.t_rating['state'] = DISABLED
self.t_vote['state'] = DISABLED
self.b_0_keyword['state'] = DISABLED
self.t_vote_keyword['state'] = DISABLED
self.b_0['text'] = 'Trying to search'
self.jsondata = ""
json_moviedata = loads(moviedata)
for sub_moviedata in json_moviedata:
if(sub_moviedata['title'] == self.c_type.get()):
res_data = get_url_data_in_ranking_list(sub_moviedata['type'], self.t_count.get(), self.t_rating.get(), self.t_vote.get())
if len(res_data) == 2:
res_list = res_data[0]
jsondata = res_data[1]
self.jsondata = jsondata
self.add_tree(res_list, self.treeview)
else:
err_str = res_data[0]
messagebox.showinfo('Notification', err_str[:1000])
self.b_0['state'] = NORMAL
self.c_type['state'] = 'readonly'
self.t_count['state'] = NORMAL
self.t_rating['state'] = NORMAL
self.t_vote['state'] = NORMAL
self.b_0_keyword['state'] = NORMAL
self.t_vote_keyword['state'] = NORMAL
self.b_0['text'] = 'Search by ranking'
def keyboard_t_vote_keyword(self, event):
"""
:param event:
:return:
"""
thread_it(self.searh_movie_in_keyword)
def searh_movie_in_keyword(self):
self.clear_tree(self.treeview)
self.b_0['state'] = DISABLED
self.c_type['state'] = DISABLED
self.t_count['state'] = DISABLED
self.t_rating['state'] = DISABLED
self.t_vote['state'] = DISABLED
self.b_0_keyword['state'] = DISABLED
self.t_vote_keyword['state'] = DISABLED
self.b_0_keyword['text'] = 'Trying to search'
self.jsondata = ""
res_data = get_url_data_in_keyword(self.t_vote_keyword.get())
if len(res_data) == 2:
res_list = res_data[0]
jsondata = res_data[1]
self.jsondata = jsondata
self.add_tree(res_list, self.treeview)
else:
err_str = res_data[0]
messagebox.showinfo('Notification', err_str[:1000])
# Formal status
self.b_0['state'] = NORMAL
self.c_type['state'] = 'readonly'
self.t_count['state'] = NORMAL
self.t_rating['state'] = NORMAL
self.t_vote['state'] = NORMAL
self.b_0_keyword['state'] = NORMAL
self.t_vote_keyword['state'] = NORMAL
self.b_0_keyword['text'] = 'Search by keywords'
def open_in_browser_douban_url(self, event):
"""
:param
:return:
"""
item = self.treeview.selection()
if item:
item_text = self.treeview.item(item, "values")
movie_name = item_text[0]
for movie in self.jsondata:
if(movie['title'] == movie_name):
open(movie['url'])
def open_in_browser(self, event):
"""
:param
:return:
"""
item = self.treeview_play_online.selection()
if(item):
item_text = self.treeview_play_online.item(item, "values")
url = item_text[2]
open(url)
def open_in_browser_cloud_disk(self, event):
"""
:param
:return:
"""
item = self.treeview_save_cloud_disk.selection()
if(item):
item_text = self.treeview_save_cloud_disk.item(item, "values")
url = item_text[2]
open(url)
def open_in_browser_bt_download(self, event):
"""
:param
:return:
"""
item = self.treeview_bt_download.selection()
if(item):
item_text = self.treeview_bt_download.item(item, "values")
url = item_text[2]
open(url)
def ui_process(self):
"""
:param
:return:
"""
root = Tk()
self.root = root
# Setting the window position
root.title("Little Movie Assistant(Support for filtering and downloading movies, etc.)")
self.center_window(root, 1000, 565)
root.resizable(0, 0)
labelframe = LabelFrame(root, width=660, height=300, text="Search")
labelframe.place(x=5, y=5)
self.labelframe = labelframe
l_typeId = Label(labelframe, text='Film Type')
l_typeId.place(x=0, y=10)
self.l_typeId = l_typeId
comvalue = StringVar()
c_type = ttk.Combobox(labelframe, width=5, textvariable=comvalue, state='readonly')
json_moviedata = loads(moviedata) # json
movieList = []
for sub_moviedata in json_moviedata:
movieList.append(sub_moviedata['title'])
c_type["values"] = movieList # initialisation
c_type.current(9) # First
c_type.place(x=65, y=8)
self.c_type = c_type
# movie amount
l_count = Label(labelframe, text='GetQuantities:')
l_count.place(x=150, y=10)
self.l_count = l_count
# text frame
t_count = Entry(labelframe, width=5)
t_count.delete(0, END)
t_count.insert(0, '100')
t_count.place(x=220, y=7)
self.t_count = t_count
# ranking
l_rating = Label(labelframe, text='FilmRating>')
l_rating.place(x=280, y=10)
self.l_rating = l_rating
# text frame
t_rating = Entry(labelframe, width=5)
t_rating.delete(0, END)
t_rating.insert(0, '8.0')
t_rating.place(x=350, y=7)
self.t_rating = t_rating
# amount
l_vote = Label(labelframe, text='RatingQuantities>')
l_vote.place(x=410, y=10)
self.l_vote = l_vote
# text frame
t_vote = Entry(labelframe, width=7)
t_vote.delete(0, END)
t_vote.insert(0, '100000')
t_vote.place(x=480, y=7)
self.t_vote = t_vote
# Search button
#lambda
#thread_it
b_0 = Button(labelframe, text="SearchByRanking")
b_0.place(x=560, y=10)
self.b_0 = b_0
# Frame location
frame_root = Frame(labelframe, width=400)
frame_l = Frame(frame_root)
frame_r = Frame(frame_root)
self.frame_root = frame_root
self.frame_l = frame_l
self.frame_r = frame_r
# Table
columns = ("FilmName", "FilmRating", "PeerRanking", "RatingQuantities")
treeview = ttk.Treeview(frame_l, height=10, show="headings", columns=columns)
treeview.column("FilmName", width=210, anchor='center') # display column
treeview.column("FilmRating", width=210, anchor='center')
treeview.column("PeerRanking", width=100, anchor='center')
treeview.column("RatingQuantities", width=100, anchor='center')
treeview.heading("FilmName", text="FilmName") # display head
treeview.heading("FilmRating", text="FilmRating")
treeview.heading("PeerRanking", text="PeerRanking")
treeview.heading("RatingQuantities", text="RatingQuantities")
# vertical scrollbar
vbar = ttk.Scrollbar(frame_r, command=treeview.yview)
treeview.configure(yscrollcommand=vbar.set)
treeview.pack()
self.treeview = treeview
vbar.pack(side=RIGHT, fill=Y)
self.vbar = vbar
# Frame location
frame_l.grid(row=0, column=0, sticky=NSEW)
frame_r.grid(row=0, column=1, sticky=NS)
frame_root.place(x=5, y=70)
# Name
l_vote_keyword = Label(labelframe, text='FilmName')
l_vote_keyword.place(x=0, y=40)
self.l_vote_keyword = l_vote_keyword
# text frame
t_vote_keyword = Entry(labelframe, width=53)
t_vote_keyword.delete(0, END)
t_vote_keyword.insert(0, 'Evangelion')
t_vote_keyword.place(x=66, y=37)
self.t_vote_keyword = t_vote_keyword
# Search button
#lambda
#thread_it
b_0_keyword = Button(labelframe, text="SearchByKeywords")
b_0_keyword.place(x=560, y=40)
self.b_0_keyword = b_0_keyword
# Container modules
labelframe_movie_detail = LabelFrame(root, text="FilmDescription")
labelframe_movie_detail.place(x=670, y=5)
self.labelframe_movie_detail = labelframe_movie_detail
# Frame
frame_left_movie_detail = Frame(labelframe_movie_detail, width=160,height=280)
frame_left_movie_detail.grid(row=0, column=0)
self.frame_left_movie_detail = frame_left_movie_detail
frame_right_movie_detail = Frame(labelframe_movie_detail, width=160,height=280)
frame_right_movie_detail.grid(row=0, column=1)
self.frame_right_movie_detail = frame_right_movie_detail
# image
label_img = Label(frame_left_movie_detail, text="", anchor=N)
label_img.place(x=0,y=0) #Layout
self.label_img = label_img
# IMDb ranks
ft_rating_imdb = font.Font(weight=font.BOLD)
label_movie_rating_imdb = Label(frame_left_movie_detail, text="IMDb Ranks", fg='#7F00FF', font=ft_rating_imdb, anchor=NW)
label_movie_rating_imdb.place(x=0, y=250)
self.label_movie_rating_imdb = label_movie_rating_imdb
# Search button
b_0_imdb = Button(frame_left_movie_detail, text="Detail")
b_0_imdb.place(x=115, y=250)
self.b_0_imdb = b_0_imdb
# Name
ft = font.Font(size=15, weight=font.BOLD)
label_movie_name = Label(frame_right_movie_detail, text="FilmName", fg='#FF0000', font=ft,anchor=NW)
label_movie_name.place(x=0, y=0)
self.label_movie_name = label_movie_name
# Ranking
ft_rating = font.Font(weight=font.BOLD)
label_movie_rating = Label(frame_right_movie_detail, text="FilmRating", fg='#7F00FF', font=ft_rating, anchor=NW)
label_movie_rating.place(x=0, y=30)
self.label_movie_rating = label_movie_rating
# Age
ft_time = font.Font(weight=font.BOLD)
label_movie_time = Label(frame_right_movie_detail, text="MovieData", fg='#666600', font=ft_time, anchor=NW)
label_movie_time.place(x=0, y=60)
self.label_movie_time = label_movie_time
# Type
ft_type = font.Font(weight=font.BOLD)
label_movie_type = Label(frame_right_movie_detail, text="MovieType", fg='#330033', font=ft_type, anchor=NW)
label_movie_type.place(x=0, y=90)
self.label_movie_type = label_movie_type
# Actor
label_movie_actor = Label(frame_right_movie_detail, text="MovieActor", wraplength=135, justify = 'left', anchor=NW)
label_movie_actor.place(x=0, y=120)
self.label_movie_actor = label_movie_actor
labelframe_movie_play_online = LabelFrame(root, width=324, height=230, text="OnlinePlay")
labelframe_movie_play_online.place(x=5, y=305)
self.labelframe_movie_play_online = labelframe_movie_play_online
# Frame
frame_root_play_online = Frame(labelframe_movie_play_online, width=324)
frame_l_play_online = Frame(frame_root_play_online)
frame_r_play_online = Frame(frame_root_play_online)
self.frame_root_play_online = frame_root_play_online
self.frame_l_play_online = frame_l_play_online
self.frame_r_play_online = frame_r_play_online
# Table
columns_play_online = ("SourceName", "FreeOrNot","PlayAddress")
treeview_play_online = ttk.Treeview(frame_l_play_online, height=10, show="headings", columns=columns_play_online)
treeview_play_online.column("SourceName", width=90, anchor='center')
treeview_play_online.column("FreeOrNot", width=80, anchor='center')
treeview_play_online.column("PlayAddress", width=120, anchor='center')
treeview_play_online.heading("SourceName", text="SourceName")
treeview_play_online.heading("FreeOrNot", text="FreeOrNot")
treeview_play_online.heading("PlayAddress", text="PlayAddress")
# vertical scrollbar
vbar_play_online = ttk.Scrollbar(frame_r_play_online, command=treeview_play_online.yview)
treeview_play_online.configure(yscrollcommand=vbar_play_online.set)
treeview_play_online.pack()
self.treeview_play_online = treeview_play_online
vbar_play_online.pack(side=RIGHT, fill=Y)
self.vbar_play_online = vbar_play_online
# Frame location
frame_l_play_online.grid(row=0, column=0, sticky=NSEW)
frame_r_play_online.grid(row=0, column=1, sticky=NS)
frame_root_play_online.place(x=5, y=0)
labelframe_movie_save_cloud_disk = LabelFrame(root, width=324, height=230, text="SearchWithCloud")
labelframe_movie_save_cloud_disk.place(x=340, y=305)
self.labelframe_movie_save_cloud_disk = labelframe_movie_save_cloud_disk
# Frame
frame_root_save_cloud_disk = Frame(labelframe_movie_save_cloud_disk, width=324)
frame_l_save_cloud_disk = Frame(frame_root_save_cloud_disk)
frame_r_save_cloud_disk = Frame(frame_root_save_cloud_disk)
self.frame_root_save_cloud_disk = frame_root_save_cloud_disk
self.frame_l_save_cloud_disk = frame_l_save_cloud_disk
self.frame_r_save_cloud_disk = frame_r_save_cloud_disk
# Table
columns_save_cloud_disk = ("SourceName", "VerifyOrNot","PlayAddress")
treeview_save_cloud_disk = ttk.Treeview(frame_l_save_cloud_disk, height=10, show="headings", columns=columns_save_cloud_disk)
treeview_save_cloud_disk.column("SourceName", width=90, anchor='center')
treeview_save_cloud_disk.column("VerifyOrNot", width=80, anchor='center')
treeview_save_cloud_disk.column("PlayAddress", width=120, anchor='center')
treeview_save_cloud_disk.heading("SourceName", text="SourceName")
treeview_save_cloud_disk.heading("VerifyOrNot", text="VerifyOrNot")
treeview_save_cloud_disk.heading("PlayAddress", text="PlayAddress")
# vertical scrollbar
vbar_save_cloud_disk = ttk.Scrollbar(frame_r_save_cloud_disk, command=treeview_save_cloud_disk.yview)
treeview_save_cloud_disk.configure(yscrollcommand=vbar_save_cloud_disk.set)
treeview_save_cloud_disk.pack()
self.treeview_save_cloud_disk = treeview_save_cloud_disk
vbar_save_cloud_disk.pack(side=RIGHT, fill=Y)
self.vbar_save_cloud_disk = vbar_save_cloud_disk
# Frame location
frame_l_save_cloud_disk.grid(row=0, column=0, sticky=NSEW)
frame_r_save_cloud_disk.grid(row=0, column=1, sticky=NS)
frame_root_save_cloud_disk.place(x=5, y=0)
labelframe_movie_bt_download = LabelFrame(root, width=324, height=230, text="FilmDownload")
labelframe_movie_bt_download.place(x=670, y=305)
self.labelframe_movie_bt_download = labelframe_movie_bt_download
# Frame
frame_root_bt_download = Frame(labelframe_movie_bt_download, width=324)
frame_l_bt_download = Frame(frame_root_bt_download)
frame_r_bt_download = Frame(frame_root_bt_download)
self.frame_root_bt_download = frame_root_bt_download
self.frame_l_bt_download = frame_l_bt_download
self.frame_r_bt_download = frame_r_bt_download
# Table
columns_bt_download = ("SourceName", "VerifiedOrNot","PlayAddress")
treeview_bt_download = ttk.Treeview(frame_l_bt_download, height=10, show="headings", columns=columns_bt_download)
treeview_bt_download.column("SourceName", width=90, anchor='center')
treeview_bt_download.column("VerifiedOrNot", width=80, anchor='center')
treeview_bt_download.column("PlayAddress", width=120, anchor='center')
treeview_bt_download.heading("SourceName", text="SourceName")
treeview_bt_download.heading("VerifiedOrNot", text="VerifiedOrNot")
treeview_bt_download.heading("PlayAddress", text="PlayAddress")
# vertical scrollbar
vbar_bt_download = ttk.Scrollbar(frame_r_bt_download, command=treeview_bt_download.yview)
treeview_bt_download.configure(yscrollcommand=vbar_bt_download.set)
treeview_bt_download.pack()
self.treeview_bt_download = treeview_bt_download
vbar_bt_download.pack(side=RIGHT, fill=Y)
self.vbar_bt_download = vbar_bt_download
frame_l_bt_download.grid(row=0, column=0, sticky=NSEW)
frame_r_bt_download.grid(row=0, column=1, sticky=NS)
frame_root_bt_download.place(x=5, y=0)
ft = font.Font(size=14, weight=font.BOLD)
project_statement = Label(root, text=".", fg='#000000', font=ft,anchor=NW)
project_statement.place(x=5, y=540)
self.project_statement = project_statement
# bind event
treeview.bind('<<TreeviewSelect>>', self.show_movie_data)
treeview.bind('<Double-1>', self.open_in_browser_douban_url)
treeview_play_online.bind('<Double-1>', self.open_in_browser)
treeview_save_cloud_disk.bind('<Double-1>', self.open_in_browser_cloud_disk)
treeview_bt_download.bind('<Double-1>', self.open_in_browser_bt_download)
b_0.configure(command=lambda:thread_it(self.searh_movie_in_rating))
b_0_keyword.configure(command=lambda:thread_it(self.searh_movie_in_keyword))
b_0_imdb.configure(command=lambda: thread_it(self.show_imdb_rating))
t_vote_keyword.bind('<Return>', handler_adaptor(self.keyboard_t_vote_keyword))
project_statement.bind('<ButtonPress-1>', self.project_statement_show)
project_statement.bind('<Enter>', self.project_statement_get_focus)
project_statement.bind('<Leave>', self.project_statement_lose_focus)
root.mainloop()