-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGUI_ing.py
More file actions
731 lines (580 loc) ยท 29.2 KB
/
GUI_ing.py
File metadata and controls
731 lines (580 loc) ยท 29.2 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
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
from tkinter import *
from tkinter import ttk, messagebox, PhotoImage
from PIL import ImageGrab, ImageTk
from TEXT_processing import time_table, getItemsBySubTheme, setClassInfo
from itertools import product
import datetime, random, sys, os
def resource_path(relative_path):
""" Get absolute path to resource, works for dev and for PyInstaller """
try:
# PyInstaller creates a temp folder and stores path in _MEIPASS
base_path = sys._MEIPASS
except Exception:
base_path = os.path.abspath(".")
return os.path.join(base_path, relative_path)
################################################################
########## global variables ์ ์ ๋ฐ ์ด๊ธฐํ ##########
################################################################
window = Tk()
subject_list = Listbox()
window.title("TimeTable")
window.attributes('-fullscreen', True)
tab_control = ttk.Notebook(window)
tab1 = ttk.Frame(tab_control)
tab2 = ttk.Frame(tab_control)
tab3 = ttk.Frame(tab_control)
tab4 = ttk.Frame(tab_control)
tab_control.add(tab1, text='๊ณผ๋ชฉ์ ํ')
tab_control.add(tab2, text='๊ทธ๋ฃน')
tab_control.add(tab3, text='๊ฒฐ๊ณผ๋ณด๊ธฐ')
tab_control.add(tab4, text='์บก์ณ๋ชจ์')
tab_control.pack(expand=1, fill='both')
tab3_frame1, tab2_frame2, tab3_frame3, tab4_frame1 = ttk.Frame(), ttk.Frame(), ttk.Frame(), ttk.Frame()
lecture_objs = time_table(resource_path("timetable.txt"))
for obj in lecture_objs:
setClassInfo(obj)
searched_objs = []
selected_groups = [[], [], [], [], [], [], [], [], [], []]
day_name = ["", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]
time_list = ["9", "10", "11", "12", "1", "2", "3", "4", "5", "6", "7", "8", "9"]
com_num_list = []
test_lists = []
์ญ๊ต = ["None", "ํ์์ญ๋๊ต์", "์ ํ์ญ๋๊ต์"]
ํต๊ต = ["None", "๋ฌธํ๊ณผ๋ฌธํ", "์ญ์ฌ์์ฒ ํ", "์ธ๊ฐ๊ณผ์ฌํ", "๊ณผํ๊ณผ๊ธฐ์ ", "์์ ๊ณผ์ฒด์ก", "์ต๋ณตํฉ์์ญ"]
๊ฐ๊ต = ["None", "์ง๋กยท์ทจ์
", "์ฐฝ์
ยท์ฐํํ๋ ฅ", "๊ธฐํ"]
๊ธฐ์ด = ["None", "์ธ๊ตญ์ด๊ณ์ด", "์ธ๋ฌธ์ฌํ๊ณ์ด", "์์ฐ๊ณ์ด"]
๊ต์ง = ["None", "๊ต์ง"]
์ผ๋ฐ = ["None", "์ผ๋ฐ์ ํ"]
์ ๊ณต = ["None", "์ ๊ณตํ์", "์ ๊ณต์ ํ"]
##############################################################
################### ํจ์ ์ ์ ###################
##############################################################
def In_Lecture(): # In๋ฒํผ ๋๋ฅด๋ฉด group์ ์ถ๊ฐ
global selected_groups, subject_list, searched_objs, variety1, tab2_list_boxes
chosen_group = int(variety1.get()) # ์ ํํ ๊ทธ๋ฃน๋ฒํธ
idx = -1
try:
idx = subject_list.curselection()[0] # ๋ฆฌ์คํธ๋ฐ์ค์์ ์ ํ๋ ๊ณผ๋ชฉ์ ์ธ๋ฑ์ค
except:
messagebox.showinfo("์ค๋ฅ", "๊ณผ๋ชฉ์ ์ ํํ์ธ์")
return
dupl = False
for k in range(10):
if searched_objs[idx] in selected_groups[k]:
messagebox.showinfo("์ค๋ณต ๋ด๊ธฐ", "์ด๋ฏธ ๋ด์ ๊ณผ๋ชฉ์
๋๋ค.")
dupl = True
break
if not dupl:
selected_groups[chosen_group].append(searched_objs[idx])
messagebox.showinfo("์ฑ๊ณต", "๊ณผ๋ชฉ์ ๋ด์์ต๋๋ค.")
tab2_list_boxes[chosen_group].insert("end", selected_groups[chosen_group][-1].get_brief_info())
def exit_window(): # ํ๋ก๊ทธ๋จ ์ข
๋ฃ
global window
window.destroy()
def search_subjects(): # Search๋ฒํผ ๋๋ฅด๋ฉด ์กฐ๊ฑด์ ๋ง๋ ๊ฐ์๋ค์ ๋ณด์ฌ์ค
global searched_objs, search_by_name_or_prof
searched_objs = [] # ๋ถ๋ฅผ๋๋ง๋ค ์ด๊ธฐํ
name = search_by_name_or_prof.get()
yeok = cb1.get()
tong = cb2.get()
gae = cb3.get()
gicho = cb4.get()
gyojik = cb5.get()
ilban = cb6.get()
cs = cb7.get()
if name != "๊ฐ์๋ช
๋๋ ๊ต์๋ช
์ ์
๋ ฅํ์ธ์": # ๊ฒ์์ด์ ๋ฌด์ธ๊ฐ๋ผ๋ ์ ํ์๋ ๊ฒฝ์ฐ
if yeok == "None" and tong == "None" and gae == "None" and \
gicho == "None" and gyojik == "None" and ilban == "None" and cs == "None": # ๊ฒ์์ด๋ง ์ ์ ๊ฒฝ์ฐ
for lecture_obj in lecture_objs:
if name in lecture_obj.name or name in lecture_obj.prof: # ๊ฐ์๋ช
๋๋ ๊ต์๋ช
์์ ์ฐพ๋๋ค.
searched_objs.append(lecture_obj)
else: # ๊ฒ์์ด์ ์ต์
์ ํจ๊ป ๊ณ ๋ฅธ ๊ฒฝ์ฐ
if yeok != "None" and tong == "None" and gae == "None" and \
gicho == "None" and gyojik == "None" and ilban == "None" and cs == "None": # ์ญ๋๊ต์์์ ์ ํ
for lecture_obj in getItemsBySubTheme(yeok, lecture_objs):
if name in lecture_obj.name or name in lecture_obj.prof:
searched_objs.append(lecture_obj)
elif yeok == "None" and tong != "None" and gae == "None" and \
gicho == "None" and gyojik == "None" and ilban == "None" and cs == "None": # ํตํฉ๊ต์์์ ์ ํ
for lecture_obj in getItemsBySubTheme(tong, lecture_objs):
if name in lecture_obj.name or name in lecture_obj.prof:
searched_objs.append(lecture_obj)
elif yeok == "None" and tong == "None" and gae != "None" and \
gicho == "None" and gyojik == "None" and ilban == "None" and cs == "None": # ๊ฐ์ฒ๊ต์์์ ์ ํ
for lecture_obj in getItemsBySubTheme(gae, lecture_objs):
if name in lecture_obj.name or name in lecture_obj.prof:
searched_objs.append(lecture_obj)
elif yeok == "None" and tong == "None" and gae == "None" and \
gicho != "None" and gyojik == "None" and ilban == "None" and cs == "None": # ๊ธฐ์ด๊ณผ์ ์์ ์ ํ
for lecture_obj in getItemsBySubTheme(gicho, lecture_objs):
if name in lecture_obj.name or name in lecture_obj.prof:
searched_objs.append(lecture_obj)
elif yeok == "None" and tong == "None" and gae == "None" and \
gicho == "None" and gyojik != "None" and ilban == "None" and cs == "None": # ๊ต์ง์์ ์ ํ
for lecture_obj in getItemsBySubTheme(gyojik, lecture_objs):
if name in lecture_obj.name or name in lecture_obj.prof:
searched_objs.append(lecture_obj)
elif yeok == "None" and tong == "None" and gae == "None" and \
gicho == "None" and gyojik == "None" and ilban != "None" and cs == "None": # ์ผ๋ฐ์ ํ์์ ์ ํ
for lecture_obj in getItemsBySubTheme(ilban, lecture_objs):
if name in lecture_obj.name or name in lecture_obj.prof:
searched_objs.append(lecture_obj)
elif yeok == "None" and tong == "None" and gae == "None" and \
gicho == "None" and gyojik == "None" and ilban == "None" and cs != "None": # CS์ ๊ณต์์ ์ ํ
for lecture_obj in getItemsBySubTheme(cs, lecture_objs):
if name in lecture_obj.name or name in lecture_obj.prof:
searched_objs.append(lecture_obj)
else: # ๋ค์ค์ ํ
messagebox.showinfo("์ต์
๋ค์ค ์ ํ", "์ต์
์ ํ๋๋ง ๊ณจ๋ผ์ฃผ์ธ์.")
elif name == "๊ฐ์๋ช
๋๋ ๊ต์๋ช
์ ์
๋ ฅํ์ธ์" or name == "": # ๊ฒ์์ด ์๋ ๊ฒฝ์ฐ
if yeok == "None" and tong == "None" and gae == "None" and \
gicho == "None" and gyojik == "None" and ilban == "None" and cs == "None":
messagebox.showinfo("ํํฐ์์", "๊ฐ์๋ช
/๊ต์๋ช
์ผ๋ก ๊ฒ์ํ๊ฑฐ๋ ์ต์
ํ ๊ฐ๋ฅผ ๊ณจ๋ผ์ฃผ์ธ์.") # ์๋ฌด๊ฒ๋ ์๊ณ ๋ฅธ๊ฒฝ์ฐ
else: # ์ต์
์ ๊ณ ๋ฅด๊ธด ๊ณ ๋ฅธ ๊ฒฝ์ฐ
if yeok != "None" and tong == "None" and gae == "None" and \
gicho == "None" and gyojik == "None" and ilban == "None" and cs == "None": # ์ญ๋๊ต์์์ ์ ํ
searched_objs = getItemsBySubTheme(yeok, lecture_objs)
elif yeok == "None" and tong != "None" and gae == "None" and \
gicho == "None" and gyojik == "None" and ilban == "None" and cs == "None": # ํตํฉ๊ต์์์ ์ ํ
searched_objs = getItemsBySubTheme(tong, lecture_objs)
elif yeok == "None" and tong == "None" and gae != "None" and \
gicho == "None" and gyojik == "None" and ilban == "None" and cs == "None": # ๊ฐ์ฒ๊ต์์์ ์ ํ
searched_objs = getItemsBySubTheme(gae, lecture_objs)
elif yeok == "None" and tong == "None" and gae == "None" and \
gicho != "None" and gyojik == "None" and ilban == "None" and cs == "None": # ๊ธฐ์ด๊ณผ์ ์์ ์ ํ
searched_objs = getItemsBySubTheme(gicho, lecture_objs)
elif yeok == "None" and tong == "None" and gae == "None" and \
gicho == "None" and gyojik != "None" and ilban == "None" and cs == "None": # ๊ต์ง์์ ์ ํ
searched_objs = getItemsBySubTheme(gyojik, lecture_objs)
elif yeok == "None" and tong == "None" and gae == "None" and \
gicho == "None" and gyojik == "None" and ilban != "None" and cs == "None": # ์ผ๋ฐ์ ํ์์ ์ ํ
searched_objs = getItemsBySubTheme(ilban, lecture_objs)
elif yeok == "None" and tong == "None" and gae == "None" and \
gicho == "None" and gyojik == "None" and ilban == "None" and cs != "None": # CS์ ๊ณต์์ ์ ํ
searched_objs = getItemsBySubTheme(cs, lecture_objs)
else: # ๋ค์ค์ ํ
messagebox.showinfo("์ต์
๋ค์ค ์ ํ", "์ต์
์ ํ๋๋ง ๊ณจ๋ผ์ฃผ์ธ์.")
# List box
global tab1, subject_list
winf = ttk.Frame(tab1)
winf.grid(row=1, column=2, rowspan=15)
subject_list = Listbox(winf, width=70, height=20)
subject_list.pack(side="left")
for i in range(len(searched_objs)):
subject_list.insert(i, searched_objs[i].get_brief_info() + searched_objs[i].get_day_info())
scrollbar = Scrollbar(winf, command=subject_list.yview)
scrollbar.pack(side="right", fill="y")
subject_list.config(yscrollcommand=scrollbar.set)
search_by_name_or_prof.delete(0, 'end')
search_by_name_or_prof.insert(0, "๊ฐ์๋ช
๋๋ ๊ต์๋ช
์ ์
๋ ฅํ์ธ์")
def shot():
global tab4_frame1, captured, ldr, scb2
img = ImageGrab.grab((2, 25, 533, 700))
nowdate = datetime.datetime.now()
re_now = nowdate.strftime("%Y-%m-%d %H%M%S")
img.save(resource_path('MyTables_/' + re_now + '.png'))
tab4_frame1 = ttk.Frame(tab4)
tab4_frame1.grid(row=0, column=1)
captured = Listbox(tab4_frame1, width=20, height=10)
ldr = os.listdir(resource_path("MyTables_"))
for i in range(len(ldr) - 1):
captured.insert(i, ldr[i + 1])
captured.pack(side="left")
scb2 = Scrollbar(tab4_frame1, command=captured.yview)
scb2.pack(side = "right", fill = "y")
captured.config(yscrollcommand=scb2.set)
def combinating():
global tab3_frame2, test_lists
test_lists = []
real_groups = []
all_possible_case = []
msg = ""
for group in selected_groups:
if len(group) != 0:
real_groups.append(group)
all_case = list(product(*real_groups))
for i in all_case:
if is_possible_combination(i):
all_possible_case.append(i)
if len(all_possible_case) >= 60:
test_lists = random.sample(all_possible_case, 60)
msg = str(len(all_possible_case)) + "๊ฐ์ง์ ์๊ฐํ ์ค 60๊ฐ๋ฅผ ์์ฑํ์์ต๋๋ค.\n๊ฒฐ๊ณผ๋ณด๊ธฐ ํญ์์ ํ์ธํ์ธ์."
else:
random.shuffle(all_possible_case)
test_lists = all_possible_case
msg = str(len(test_lists)) + "๊ฐ์ง์ ์๊ฐํ๊ฐ ์์ฑ๋์์ต๋๋ค.\n๊ฒฐ๊ณผ๋ณด๊ธฐ ํญ์์ ํ์ธํ์ธ์."
messagebox.showinfo("์กฐํฉ์ฑ๊ณต", msg)
#####################################
####### tab 3-2 (๊ฒฐ๊ณผ๋ณด๊ธฐ) #######
#####################################
frame_in_frame = ttk.Frame(tab3_frame2)
frame_in_frame.grid(row=4, column=7)
combi = Listbox(frame_in_frame, width=5, height=5)
for i in range(len(test_lists)):
combi.insert(i, i + 1)
combi.pack(side="left")
scb = Scrollbar(frame_in_frame, command=first_list.yview)
scb.pack(side = "right", fill = "y")
combi.config(yscrollcommand=scb.set)
def see_combi2(): # ์ ํ๋ ์กฐํฉ ์ ์ฉ
global tab3_frame1, tab3_frame3, test_lists
com_num = -1
tab3_frame3 = ttk.Frame(tab3)
tab3_frame3.grid(row=0, column=0)
for i in range(0, 7): # ์๊ฐํ ํ(ํฐ)
Label(tab3_frame3, text=day_name[i], width=10, bg="RoyalBlue", fg="white").grid(row=1, column=i)
for k in range(len(time_list)):
if i == 0:
Label(tab3_frame3, text=time_list[k], width=10, height=3, bg="white", anchor="n").grid(row=k + 2, column=i)
else:
Label(tab3_frame3, width=10, height=3, bg="white",relief='solid', bd=0.1).grid(row=k + 2, column=i)
time_color_list = ['#181A2C', '#152747', '#1F3767', '#496B91', '#025373', '#012E40','#186884', '#63B6BF', '#67B8DE', '#91C9E8', '#3399CC', '#5F7ED9'] # 14๊ฐ์ง ์์(์ฒญ์๊ณ์ด)
random.shuffle(time_color_list)
try:
com_num = combi.curselection()[0]
com_num_list.append(com_num)
for lectures in range(len(test_lists[com_num])): # ๊ณผ๋ชฉ ์
for lecture_day in range(len(test_lists[com_num][lectures].day)):# ๊ณผ๋ชฉ ์ชผ๊ฐ์ง ์์ผ
for classtime in range(len((test_lists[com_num][lectures].day)[lecture_day]) - 1):# ์ฐจ์
c_time = (test_lists[com_num][lectures].day)[lecture_day][1:] # ์ฐจ์ ๋ฆฌ์คํธ
c_time_row = c_time[classtime]
num_label = Label(tab3_frame3, text=test_lists[com_num][lectures].name, width=10, height=3, bg=time_color_list[lectures], bd=1, fg='white', highlightbackground='darkgrey', wraplength = 60)
num_label.grid(row=c_time_row + 1, column=(test_lists[com_num][lectures].day)[lecture_day][0] + 1)
except:
return
def see_combi(): # ์ด์ ์๊ฐํ ์ญ์ ๋ฐ ์ ํ๋ ์๊ฐํ ํ์
global tab3_frame1, tab3_frame3, test_lists
if len(com_num_list) == 0:
tab3_frame1.destroy()
else:
tab3_frame3.destroy()
see_combi2()
Button(tab3_frame2, text="See", width=10, bg="skyblue", command=see_combi).grid(row=7, column=7)
Label(tab3_frame2, text = "\n์คํฌ๋ฆฐ์ท์ 1920x1080 ํด์๋์\n์ต์ ํ๋์ด ์์ต๋๋ค.").grid(row=8, column=7)
# ์กฐํฉ ์ฝค๋ณด๋ฐ์ค ์์ ๋ญ์ง ์ค๋ช
ํ๋ ๋ง
combo_label = Label(tab3_frame2, text="๋น์ ์ด ์ํ๋ ์กฐํฉ์ ๊ณจ๋ผ๋ณด์ธ์!!\n โ ")
combo_label.grid(row=3, column=7)
Button(tab3_frame2, text="Screenshot", width=10, bg="skyblue", command=shot).grid(row=9, column=7)
def is_possible_combination(time_table):
check = [[0] * 13 for _ in range(6)]
for lecture_obj in time_table:
if lecture_obj.day == "null":
continue
for detail_day in lecture_obj.day:
for specific_time in detail_day[1:]:
check[detail_day[0]][specific_time - 1] += 1
for d in check:
for c in d:
if c >= 2:
return False
return True
def entry_delete(event):
search_by_name_or_prof.delete(0, 'end')
def OUT1():
try:
first_idx = first_list.curselection()[0]
first_list.delete(first_idx)
selected_groups[0].pop(first_idx)
except:
pass
def OUT2():
try:
second_idx = second_list.curselection()[0]
second_list.delete(second_idx)
selected_groups[1].pop(second_idx)
except:
pass
def OUT3():
try:
third_idx = third_list.curselection()[0]
third_list.delete(third_idx)
selected_groups[2].pop(third_idx)
except:
pass
def OUT4():
try:
fourth_idx = fourth_list.curselection()[0]
fourth_list.delete(fourth_idx)
selected_groups[3].pop(fourth_idx)
except:
pass
def OUT5():
try:
fifth_idx = fifth_list.curselection()[0]
fifth_list.delete(fifth_idx)
selected_groups[4].pop(fifth_idx)
except:
pass
def OUT6():
try:
sixth_idx = sixth_list.curselection()[0]
sixth_list.delete(sixth_idx)
selected_groups[5].pop(sixth_idx)
except:
pass
def OUT7():
try:
seventh_idx = seventh_list.curselection()[0]
seventh_list.delete(seventh_idx)
selected_groups[6].pop(seventh_idx)
except:
pass
def OUT8():
try:
eighth_idx = eighth_list.curselection()[0]
eighth_list.delete(eighth_idx)
selected_groups[7].pop(eighth_idx)
except:
pass
def OUT9():
try:
nineth_idx = nineth_list.curselection()[0]
nineth_list.delete(nineth_idx)
selected_groups[8].pop(nineth_idx)
except:
pass
def OUT10():
try:
tenth_idx = tenth_list.curselection()[0]
tenth_list.delete(tenth_idx)
selected_groups[9].pop(tenth_idx)
except:
pass
################################################################
########### tab๋ง๋ค ๊ธฐ๋ฅ๊ตฌํ(tab1 ~ tab4) ###########
################################################################
#####################################
######## tab 1 (๊ณผ๋ชฉ์ ํ) ########
#####################################
Label(tab1, text="๊ณผ๋ชฉ๊ฒ์", font=("", 13), width=21, bg="SteelBlue1", fg="white").grid(row=0, column=0)
Label(tab1, text="๊ทธ๋ฃน์ ํ", font=("", 13), width=10, bg="SteelBlue2", fg="white").grid(row=0, column=1)
Label(tab1, text="๊ฐ์๋ชฉ๋ก", font=("", 13), width=56, bg="SteelBlue3", fg="white").grid(row=0, column=2)
search_by_name_or_prof = Entry(tab1, width=27, highlightbackground='white', highlightcolor='sky blue')
search_by_name_or_prof.grid(row=1, column=0)
search_by_name_or_prof.insert(0, '๊ฐ์๋ช
๋๋ ๊ต์๋ช
์ ์
๋ ฅํ์ธ์')
search_by_name_or_prof.bind('<Button-1>', entry_delete)
Label(tab1, text="์ญ๋๊ต์", width=27, bg="RoyalBlue", fg="white").grid(row=2, column=0)
cb1 = ttk.Combobox(tab1, width=24, height=10, values=์ญ๊ต, state="readonly")
cb1.grid(row=3, column=0)
cb1.set("None")
Label(tab1, text="ํตํฉ๊ต์", width=27, bg="RoyalBlue", fg="white").grid(row=4, column=0)
cb2 = ttk.Combobox(tab1, width=24, height=10, values=ํต๊ต, state="readonly")
cb2.grid(row=5, column=0)
cb2.set("None")
Label(tab1, text="๊ฐ์ฒ๊ต์", width=27, bg="RoyalBlue", fg="white").grid(row=6, column=0)
cb3 = ttk.Combobox(tab1, width=24, height=10, values=๊ฐ๊ต, state="readonly")
cb3.grid(row=7, column=0)
cb3.set("None")
Label(tab1, text="๊ธฐ์ด๊ณผ์ ", width=27, bg="RoyalBlue", fg="white").grid(row=8, column=0)
cb4 = ttk.Combobox(tab1, width=24, height=10, values=๊ธฐ์ด, state="readonly")
cb4.grid(row=9, column=0)
cb4.set("None")
Label(tab1, text="๊ต์ง", width=27, bg="RoyalBlue", fg="white").grid(row=10, column=0)
cb5 = ttk.Combobox(tab1, width=24, height=10, values=๊ต์ง, state="readonly")
cb5.grid(row=11, column=0)
cb5.set("None")
Label(tab1, text="์ผ๋ฐ์ ํ", width=27, bg="RoyalBlue", fg="white").grid(row=12, column=0)
cb6 = ttk.Combobox(tab1, width=24, height=10, values=์ผ๋ฐ, state="readonly")
cb6.grid(row=13, column=0)
cb6.set("None")
Label(tab1, text="CS์ ๊ณต", width=27, bg="RoyalBlue", fg="white").grid(row=14, column=0)
cb7 = ttk.Combobox(tab1, width=24, height=10, values=์ ๊ณต, state="readonly")
cb7.grid(row=15, column=0)
cb7.set("None")
Button(tab1, text="๊ฒ์", width=10, bg='skyblue', command=search_subjects).grid(row=16, column=0)
groups_frame = ttk.Frame(tab1)
groups_frame.grid(row=1, column=1, rowspan=15)
variety1 = IntVar(value=0)
Radiobutton(groups_frame, text="Group1", value=0, variable=variety1).pack()
Radiobutton(groups_frame, text="Group2", value=1, variable=variety1).pack()
Radiobutton(groups_frame, text="Group3", value=2, variable=variety1).pack()
Radiobutton(groups_frame, text="Group4", value=3, variable=variety1).pack()
Radiobutton(groups_frame, text="Group5", value=4, variable=variety1).pack()
Radiobutton(groups_frame, text="Group6", value=5, variable=variety1).pack()
Radiobutton(groups_frame, text="Group7", value=6, variable=variety1).pack()
Radiobutton(groups_frame, text="Group8", value=7, variable=variety1).pack()
Radiobutton(groups_frame, text="Group9", value=8, variable=variety1).pack()
Radiobutton(groups_frame, text="Group10", value=9, variable=variety1).pack()
Button(tab1, text="์ถ๊ฐ", width=8, bg='sky blue', command=In_Lecture).grid(row=16, column=2)
#####################################
######## tab 2 (๊ทธ๋ฃน๋ณด๊ธฐ) ########
#####################################
group_list = ["Group1", "Group2", "Group3", "Group4", "Group5", "Group6", "Group7", "Group8", "Group9", "Group10"]
# 1
Label(tab2, text=group_list[0], width=37, bg="RoyalBlue", fg="white").grid(row=0, column=0)
win1 = ttk.Frame(tab2)
win1.grid(row=1, column=0, rowspan=1)
first_list = Listbox(win1, width=35, height=5)
first_list.pack(side="left")
scrollbar1 = Scrollbar(win1, command=first_list.yview)
scrollbar1.pack(side="right", fill="y")
first_list.config(yscrollcommand=scrollbar1.set)
# 2
Label(tab2, text=group_list[1], width=37, bg="RoyalBlue", fg="white").grid(row=0, column=1)
win2 = ttk.Frame(tab2)
win2.grid(row=1, column=1, rowspan=1)
second_list = Listbox(win2, width=35, height=5)
second_list.pack(side="left")
scrollbar2 = Scrollbar(win2, command=second_list.yview)
scrollbar2.pack(side="right", fill="y")
second_list.config(yscrollcommand=scrollbar2.set)
# 3
Label(tab2, text=group_list[2], width=37, bg="RoyalBlue", fg="white").grid(row=2, column=0)
win3 = ttk.Frame(tab2)
win3.grid(row=3, column=0, rowspan=1)
third_list = Listbox(win3, width=35, height=5)
third_list.pack(side="left")
scrollbar3 = Scrollbar(win3, command=third_list.yview)
scrollbar3.pack(side="right", fill="y")
third_list.config(yscrollcommand=scrollbar3.set)
# 4
Label(tab2, text=group_list[3], width=37, bg="RoyalBlue", fg="white").grid(row=2, column=1)
win4 = ttk.Frame(tab2)
win4.grid(row=3, column=1, rowspan=1)
fourth_list = Listbox(win4, width=35, height=5)
fourth_list.pack(side="left")
scrollbar4 = Scrollbar(win4, command=fourth_list.yview)
scrollbar4.pack(side="right", fill="y")
fourth_list.config(yscrollcommand=scrollbar4.set)
# 5
Label(tab2, text=group_list[4], width=37, bg="RoyalBlue", fg="white").grid(row=4, column=0)
win5 = ttk.Frame(tab2)
win5.grid(row=5, column=0, rowspan=1)
fifth_list = Listbox(win5, width=35, height=5)
fifth_list.pack(side="left")
scrollbar5 = Scrollbar(win5, command=fifth_list.yview)
scrollbar5.pack(side="right", fill="y")
fifth_list.config(yscrollcommand=scrollbar5.set)
# 6
Label(tab2, text=group_list[5], width=37, bg="RoyalBlue", fg="white").grid(row=4, column=1)
win6 = ttk.Frame(tab2)
win6.grid(row=5, column=1, rowspan=1)
sixth_list = Listbox(win6, width=35, height=5)
sixth_list.pack(side="left")
scrollbar6 = Scrollbar(win6, command=sixth_list.yview)
scrollbar6.pack(side="right", fill="y")
sixth_list.config(yscrollcommand=scrollbar6.set)
# 7
Label(tab2, text=group_list[6], width=37, bg="RoyalBlue", fg="white").grid(row=6, column=0)
win7 = ttk.Frame(tab2)
win7.grid(row=7, column=0, rowspan=1)
seventh_list = Listbox(win7, width=35, height=5)
seventh_list.pack(side="left")
scrollbar7 = Scrollbar(win7, command=seventh_list.yview)
scrollbar7.pack(side="right", fill="y")
seventh_list.config(yscrollcommand=scrollbar7.set)
# 8
Label(tab2, text=group_list[7], width=37, bg="RoyalBlue", fg="white").grid(row=6, column=1)
win8 = ttk.Frame(tab2)
win8.grid(row=7, column=1, rowspan=1)
eighth_list = Listbox(win8, width=35, height=5)
eighth_list.pack(side="left")
scrollbar8 = Scrollbar(win8, command=eighth_list.yview)
scrollbar8.pack(side="right", fill="y")
eighth_list.config(yscrollcommand=scrollbar8.set)
# 9
Label(tab2, text=group_list[8], width=37, bg="RoyalBlue", fg="white").grid(row=8, column=0)
win9 = ttk.Frame(tab2)
win9.grid(row=9, column=0, rowspan=1)
nineth_list = Listbox(win9, width=35, height=5)
nineth_list.pack(side="left")
scrollbar9 = Scrollbar(win9, command=nineth_list.yview)
scrollbar9.pack(side="right", fill="y")
nineth_list.config(yscrollcommand=scrollbar3.set)
# 10
Label(tab2, text=group_list[9], width=37, bg="RoyalBlue", fg="white").grid(row=8, column=1)
win10 = ttk.Frame(tab2)
win10.grid(row=9, column=1, rowspan=1)
tenth_list = Listbox(win10, width=35, height=5)
tenth_list.pack(side="left")
scrollbar10 = Scrollbar(win10, command=tenth_list.yview)
scrollbar10.pack(side="right", fill="y")
tenth_list.config(yscrollcommand=scrollbar10.set)
# ๊ทธ๋ฃน์์ ๊ณผ๋ชฉ ์ญ์ ํ๋ ๋ฒํผ ๋ฐ merge
Button(tab2, text="OUT 1", width=10, bg='skyblue', command=OUT1).grid(row=0, column=2, rowspan=1)
Button(tab2, text="OUT 2", width=10, bg='skyblue', command=OUT2).grid(row=1, column=2, rowspan=1)
Button(tab2, text="OUT 3", width=10, bg='skyblue', command=OUT3).grid(row=2, column=2, rowspan=1)
Button(tab2, text="OUT 4", width=10, bg='skyblue', command=OUT4).grid(row=3, column=2, rowspan=1)
Button(tab2, text="OUT 5", width=10, bg='skyblue', command=OUT5).grid(row=4, column=2, rowspan=1)
Button(tab2, text="OUT 6", width=10, bg='skyblue', command=OUT6,).grid(row=5, column=2, rowspan=1)
Button(tab2, text="OUT 7", width=10, bg='skyblue', command=OUT7).grid(row=6, column=2, rowspan=1)
Button(tab2, text="OUT 8", width=10, bg='skyblue', command=OUT8).grid(row=7, column=2, rowspan=1)
Button(tab2, text="OUT 9", width=10, bg='skyblue', command=OUT9).grid(row=8, column=2, rowspan=1)
Button(tab2, text="OUT 10", width=10, bg='skyblue', command=OUT10).grid(row=9, column=2)
Button(tab2, text="Merge", width=10, bg='skyblue1', command=combinating).grid(row=10, column=2)
tab2_list_boxes = [
first_list, second_list, third_list, fourth_list, fifth_list, sixth_list, seventh_list, eighth_list, nineth_list, tenth_list
]
#####################################
####### tab 3-1 (๊ฒฐ๊ณผ๋ณด๊ธฐ) #######
#####################################
tab3_frame1 = ttk.Frame(tab3, relief='flat')
tab3_frame1.grid(row=0, column=0)
tab3_frame2 = ttk.Frame(tab3, relief='flat')
tab3_frame2.grid(row=0, column=1)
for i in range(0, 7): # ์๊ฐํ ํ
Label(tab3_frame1, text=day_name[i], width=10, bg="RoyalBlue", fg="white").grid(row=1, column=i)
for k in range(len(time_list)):
if i == 0:
Label(tab3_frame1, text=time_list[k], width=10, height=3, bg="white", anchor="n").grid( row=k+2, column=i)
else:
Label(tab3_frame1, width=10, height=3, bg="white", relief='solid', bd=0.1).grid(row=k+2, column=i)
#####################################
####### tab 4 (์บก์ณ๋ชจ์) #######
#####################################
def show_shot_img():
global captured, ldr, shot_img
idx = -1
try:
idx = captured.curselection()[0] # ๋ฆฌ์คํธ๋ฐ์ค์์ ์ ํ๋ ๊ณผ๋ชฉ์ ์ธ๋ฑ์ค
except:
messagebox.showinfo("์ค๋ฅ", "์ฌ์ง์ ์ ํํ์ธ์")
return
img2 = PhotoImage(file = (resource_path("MyTables_/" + ldr[idx + 1])))
shot_img.configure(image=img2)
shot_img.image = img2
Button(tab4, text = "๋ณด๊ธฐ", width=10, bg="skyblue", command=show_shot_img).grid(row=1, column=1)
asd = PhotoImage(file = resource_path("MyTables_/0basic.png"))
shot_img = Label(tab4, image=asd)
shot_img.grid(row=0, column=0, rowspan = 15)
tab4_frame1 = ttk.Frame(tab4)
tab4_frame1.grid(row=0, column=1)
captured = Listbox(tab4_frame1, width=20, height=10)
ldr = os.listdir(resource_path("MyTables_"))
for i in range(len(ldr) - 1):
captured.insert(i, ldr[i + 1])
captured.pack(side="left")
scb2 = Scrollbar(tab4_frame1, command=captured.yview)
scb2.pack(side = "right", fill = "y")
captured.config(yscrollcommand=scb2.set)
def file_delete():
global captured, ldr
idx = -1
try:
idx = captured.curselection()[0] # ๋ฆฌ์คํธ๋ฐ์ค์์ ์ ํ๋ ๊ณผ๋ชฉ์ ์ธ๋ฑ์ค
except:
messagebox.showinfo("์ค๋ฅ", "ํ์ผ์ ์ ํํ์ธ์")
return
file_dir = resource_path("MyTables_/" + ldr[idx + 1])
if os.path.isfile(file_dir):
os.remove(file_dir)
else:
messagebox.showinfo("์ค๋ฅ", "ํ์ผ์ ์ ํํ์ธ์")
tab4_frame1 = ttk.Frame(tab4)
tab4_frame1.grid(row=0, column=1)
captured = Listbox(tab4_frame1, width=20, height=10)
ldr = os.listdir(resource_path("MyTables_"))
for i in range(len(ldr) - 1):
captured.insert(i, ldr[i + 1])
captured.pack(side="left")
scb2 = Scrollbar(tab4_frame1, command=captured.yview)
scb2.pack(side = "right", fill = "y")
captured.config(yscrollcommand=scb2.set)
# ๊ธฐํ ๋๋จธ์ง
Button(tab1, text="EXIT", width=10, bg="slateblue2", fg="white", command=exit_window).grid(row=17, column=0)
Label(tab2).grid(row=11, column=2) # ๊ณต๋ฐฑ
Button(tab2, text="EXIT", width=10, bg="slateblue2", fg="white", command=exit_window).grid(row=12, column=2)
Button(tab3, text="EXIT", width=10, bg="slateblue2", fg="white", command=exit_window).grid(row=2, column=0, sticky='w')
Button(tab4, text="์ญ์ ", width=10, bg="red", fg="white", command=file_delete).grid(row=2, column=1)
Button(tab4, text="EXIT", width=10, bg="slateblue2", fg="white", command=exit_window).grid(row=3, column=1)
window.mainloop()