- Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcode_debugger.py
More file actions
Latest commit
694 lines (577 loc) · 26.6 KB
/
Copy pathcode_debugger.py
File metadata and controls
694 lines (577 loc) · 26.6 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
importtkinterastk
fromtkinterimport*
fromtkinterimportmessagebox
fromtkinterimportttk
fromtkinterimportfiledialog
importtime
importos
importsubprocess
root=Tk()
root.state('zoomed')
root.maxsize(1920,800)
# background color
root.config(bg="grey")
Compilation_time1=0
Execution_time1=0
Compilation_time2=0
Execution_time2=0
Language1=StringVar()
Language2=StringVar()
Language3=StringVar()
val1=IntVar()
val2=IntVar()
val3=IntVar()
val1.set(1)
val2.set(1)
debug_flag=True
defcompare_files(fpath1, fpath2):
p=os.stat(fpath1).st_size
q=os.stat(fpath2).st_size
ifp==0andq!=0 : returnFalse
ifp!=0andq==0 : returnFalse
withopen(fpath1) asfile1, open(fpath2) asfile2:
forlinef1, linef2inzip(file1, file2):
linef1=linef1.rstrip()
linef2=linef2.rstrip()
#print(linef1 + " " + linef2 + "n")
iflinef1!=linef2:
returnFalse
return (next(file1, None) ==None) and (next(file2, None) ==None)
defcodconfig1():
value=val1.get()
ifvalue==0:
Path1.configure({"background": "white"})
Path1.configure(state='normal')
Button1.config(state='normal')
Code1.configure(state='disabled', bg='dim grey')
elifvalue==1:
Code1.configure(state='normal', bg='white')
Path1.configure({"background": "dim grey"})
Path1.configure(state='disabled')
Button1.config(state='disabled')
defcodconfig2():
value=val2.get()
ifvalue==0:
Path2.configure({"background": "white"})
Path2.configure(state='normal')
Button2.config(state='normal')
Code2.configure(state='disabled', bg='dim grey')
elifvalue==1:
Code2.configure(state='normal', bg='white')
Path2.configure({"background": "dim grey"})
Path2.configure(state='disabled')
Button2.config(state='disabled')
defconfigtest():
value=val3.get()
ifvalue==0:
test.configure(state='normal', bg='white')
Input_path.configure(state='disabled', bg='dim gray')
Buttontest.config(state='disabled')
Random_case.configure(state='disabled', bg='dim gray')
Buttonrandom.config(state='disabled')
langg_menu.configure(state='disabled')
elifvalue==1:
Input_path.configure(state='normal', bg='white')
Buttontest.config(state='normal')
test.configure(state='disabled', bg='dim gray')
Random_case.configure(state='disabled', bg='dim gray')
Buttonrandom.config(state='disabled')
langg_menu.configure(state='disabled')
elifvalue==2:
Random_case.configure(state='normal', bg='white')
Buttonrandom.config(state='normal')
langg_menu.configure(state='normal')
test.configure(state='disabled', bg='dim gray')
Input_path.configure(state='disabled', bg='dim gray')
Buttontest.config(state='disabled')
defretrieve_input(textbox):
inputValue=textbox.get("1.0", "end-1c")
print(inputValue)
defset_up_working_directory():
path=filedialog.askdirectory(initialdir="C:\\Users\\DIPTAYAN BISWAS\\Desktop\\Code_Debugger", title='Please select a directory')
Working_Directory.delete('1.0', END)
Working_Directory.insert(tk.END, path)
defset_up_path1():
path=filedialog.askopenfilename(initialdir="C:\\Users\\DIPTAYAN BISWAS\\Desktop\\Code_Debugger", title='Please select a directory')
Path1.delete('1.0', END)
Path1.insert(tk.END, path)
defset_up_path2():
path=filedialog.askopenfilename(initialdir="C:\\Users\\DIPTAYAN BISWAS\\Desktop\\Code_Debugger", title='Please select a directory')
Path2.delete('1.0', END)
Path2.insert(tk.END, path)
defset_up_pathtest():
path=filedialog.askopenfilename(initialdir="C:\\Users\\DIPTAYAN BISWAS\\Desktop\\Code_Debugger", title='Please select a directory', filetype=
(("text files","*.txt"),("all files","*.*")))
Input_path.delete('1.0', END)
Input_path.insert(tk.END, path)
defset_up_pathrandom():
path=filedialog.askopenfilename(initialdir="C:\\Users\\DIPTAYAN BISWAS\\Desktop\\Code_Debugger", title='Please select a directory')
Random_case.delete('1.0', END)
Random_case.insert(tk.END, path)
defclear_all():
ifval1.get()==0:
Code1.configure(state='normal')
ifval2.get()==0:
Code2.configure(state='normal')
ifval1.get()==1:
Path1.configure(state='normal')
ifval2.get()==1:
Path2.configure(state='normal')
ifval3.get() ==0:
Input_path.configure(state='normal')
Random_case.configure(state='normal')
ifval3.get() ==1:
Random_case.configure(state='normal')
test.configure(state='normal')
ifval3.get() ==2:
Input_path.configure(state='normal')
test.configure(state='normal')
Log1.config(state='normal')
Log2.config(state='normal')
Path1.delete('1.0', END)
Path2.delete('1.0', END)
Input_path.delete('1.0', END)
Random_case.delete('1.0', END)
test.delete('1.0', END)
Code1.delete('1.0', END)
Code2.delete('1.0', END)
Log1.delete('1.0', END)
Log2.delete('1.0', END)
langg_menu.set("CPP")
lang_menu1.set("CPP")
lang_menu2.set("CPP")
ifval1.get()==0:
Code1.configure(state='disabled')
ifval2.get()==0:
Code2.configure(state='disabled')
ifval1.get()==1:
Path1.configure(state='disabled')
ifval2.get()==0:
Path2.configure(state='disabled')
ifval3.get() ==0:
Input_path.configure(state='disabled')
Random_case.configure(state='disabled')
ifval3.get() ==1:
Random_case.configure(state='disabled')
test.configure(state='disabled')
ifval3.get() ==2:
Input_path.configure(state='disabled')
test.configure(state='disabled')
dir_name=Working_Directory.get("1.0", "end-1c")
tes=os.listdir(dir_name)
foritemintes:
ifitem.endswith(".class"):
os.remove(os.path.join(dir_name, item))
ifitem.endswith(".txt"):
os.remove(os.path.join(dir_name, item))
ifitem.endswith(".exe"):
os.remove(os.path.join(dir_name, item))
defsave_test_case():
ifval3.get() ==0 :
directory=Working_Directory.get("1.0", "end-1c")
save_path=directory+"\\test.txt"
text_file=open(save_path, "w")
case=test.get("1.0", "end-1c")
text_file.write(case)
text_file.close()
returnsave_path
elifval3.get() ==1 :
returnInput_path.get("1.0", "end-1c")
defrun_python_code(code_path, input_path, type) :
globaldebug_flag
globalExecution_time1
globalExecution_time2
working_dir=Working_Directory.get("1.0", "end-1c")
title_string=""
iftype=="1" : title_string="Code1"
iftype=="2": title_string="Code2"
iftype=="test" : title_string="Random Generator"
command="python "+'''"'''+str(code_path) +'''" <"'''+str(input_path) +'''"> "'''+str(working_dir) +"\op"+str(type) +'''.txt"'''
iftype=="test" :
command="python "+'''"'''+str(code_path) +'''" > "'''+str(working_dir) +r'''\test.txt"'''
print(command)
#op = subprocess.run(command, shell=True, text=True, capture_output=True)
start=time.time()
try :
op=subprocess.check_call(command,shell=True, timeout=7)
iftype=="1":
Execution_time1=time.time() -start
iftype=="2":
Execution_time2=time.time() -start
exceptExceptionase:
debug_flag=False
lol=subprocess.run("taskkill /IM Python.exe /F", shell=True, capture_output=True)
messagebox.showerror("Error", "Failed to execute "+title_string+".\nMay be there are issues with the code or it is already open in some process.\n")
return
defrun_cpp_code(code_path, input_path, type) :
globaldebug_flag
globalExecution_time1
globalExecution_time2
globalCompilation_time1
globalCompilation_time2
title_string=""
iftype=="1": title_string="Code1"
iftype=="2": title_string="Code2"
iftype=="test": title_string="Random Generator"
working_dir=Working_Directory.get("1.0", "end-1c")
command1="g++ -o"+'''"'''+working_dir+'''\m.exe" "'''+code_path+'''"'''
command2='''"'''+working_dir+'''\m.exe" <"'''+input_path+'''"> "'''+working_dir+"\op"+type+'''.txt"'''
iftype=="test" :
command1="g++ -o"+'''"'''+working_dir+'''\mm.exe" "'''+code_path+'''"'''
command2='''"'''+working_dir+'''\mm.exe" > "'''+str(working_dir) +r'''\test.txt"'''
start=time.time()
op1=subprocess.run(command1, shell=True, text=True, capture_output=True)
iftype=="1":
Compilation_time1=time.time() -start
iftype=="2":
Compilation_time2=time.time() -start
if (op1.returncode>0):
iflen(op1.stderr) !=0:
debug_flag=False
messagebox.showerror("Error","In "+title_string+"\n"+str(op1.stderr))
return
else:
debug_flag=False
messagebox.showerror("Error", "In "+title_string+"\n"+"Runtime Error")
return
start=time.time()
try :
op2=subprocess.call(command2, shell=True, timeout=5)
iftype=="1":
Execution_time1=time.time() -start
iftype=="2":
Execution_time2=time.time() -start
exceptExceptionase:
debug_flag=False
lol=subprocess.run("taskkill /IM m.exe /F",shell=True, capture_output=True)
print(lol)
messagebox.showerror("Error", "Failed to execute "+title_string+".\nPlease re-check your code.")
return
defget_file_name(path) :
head, tail=os.path.split(path)
returntail
defrun_java_code(code_path, input_path, type) :
globaldebug_flag
globalExecution_time1
globalExecution_time2
globalCompilation_time1
globalCompilation_time2
title_string=""
iftype=="1": title_string="Code1"
iftype=="2": title_string="Code2"
iftype=="test": title_string="Random Generator"
name=get_file_name(code_path)
name=name[0:len(name)-5]
working_dir=Working_Directory.get("1.0", "end-1c")
command1="javac -d "+'''"'''+working_dir+'''" "'''+code_path+'''"'''
command2='''java -cp "'''+working_dir+'''" '''+name+''' <"'''+input_path+'''"> "'''+working_dir+"\op"+type+'''.txt"'''
iftype=="test" :
command1="javac -d "+'''"'''+working_dir+'''" "'''+code_path+'''"'''
command2='''java -cp "'''+working_dir+'''" '''+name+''' > "'''+str(working_dir) +r'''\test.txt"'''
print(command1)
print(command2)
start=time.time()
op1=subprocess.run(command1, shell=True, text=True, capture_output=True)
iftype=="1":
Compilation_time1=time.time() -start
iftype=="2":
Compilation_time2=time.time() -start
if (op1.returncode>0):
iflen(op1.stderr) !=0:
debug_flag=False
messagebox.showerror("Error","In "+title_string+"\n"+str(op1.stderr))
return
else:
debug_flag=False
messagebox.showerror("Error", "In "+title_string+"\n"+"Runtime Error")
return
start=time.time()
try :
op2=subprocess.call(command2, shell=True, timeout=5)
iftype=="1":
Execution_time1=time.time() -start
iftype=="2":
Execution_time2=time.time() -start
exceptExceptionase:
debug_flag=False
lol=subprocess.run("taskkill /IM java.exe /F", shell=True, capture_output=True)
print(lol)
messagebox.showerror("Error", "Failed to execute "+title_string+".\nMay be there are issues with the code or it is already open in some process.\n")
return
defsave_python_code1() :
ifval1.get() ==1:
directory=Working_Directory.get("1.0", "end-1c")
save_path=directory+"\code1.py"
text_file=open(save_path , "w")
text_file.write(Code1.get("1.0", "end-1c"))
text_file.close()
returnsave_path
elifval1.get() ==0 :
save_path=Path1.get("1.0", "end-1c")
returnsave_path
defsave_cpp_code1() :
ifval1.get() ==1:
directory=Working_Directory.get("1.0", "end-1c")
save_path=directory+"\code1.cpp"
text_file=open(save_path , "w")
text_file.write(Code1.get("1.0", "end-1c"))
text_file.close()
returnsave_path
elifval1.get() ==0 :
save_path=Path1.get("1.0", "end-1c")
returnsave_path
defsave_java_code1() :
ifval1.get() ==1:
directory=Working_Directory.get("1.0", "end-1c")
save_path=directory+"\code1.java"
text_file=open(save_path , "w")
text_file.write(Code1.get("1.0", "end-1c"))
text_file.close()
returnsave_path
elifval1.get() ==0 :
save_path=Path1.get("1.0", "end-1c")
returnsave_path
defsave_python_code2() :
ifval2.get() ==1:
directory=Working_Directory.get("1.0", "end-1c")
save_path=directory+"\code2.py"
text_file=open(save_path , "w")
text_file.write(Code2.get("1.0", "end-1c"))
text_file.close()
returnsave_path
elifval2.get() ==0 :
save_path=Path2.get("1.0", "end-1c")
returnsave_path
defsave_cpp_code2() :
ifval2.get() ==1:
directory=Working_Directory.get("1.0", "end-1c")
save_path=directory+"\code2.cpp"
text_file=open(save_path , "w")
text_file.write(Code2.get("1.0", "end-1c"))
text_file.close()
returnsave_path
elifval2.get() ==0 :
save_path=Path2.get("1.0", "end-1c")
returnsave_path
defsave_java_code2() :
ifval2.get() ==1:
directory=Working_Directory.get("1.0", "end-1c")
save_path=directory+"\code2.java"
text_file=open(save_path , "w")
text_file.write(Code2.get("1.0", "end-1c"))
text_file.close()
returnsave_path
elifval2.get() ==0 :
save_path=Path2.get("1.0", "end-1c")
returnsave_path
defcheck_validity_of_extension(path, language) :
reverse_path=path[::-1]
iflanguage=="Python" :
iflen(path) <3 : returnFalse
ifreverse_path[0:3] !="yp." : returnFalse
iflanguage=="CPP":
iflen(path) <4 : returnFalse
ifreverse_path[0:4] !="ppc.": returnFalse
iflanguage=="Java":
iflen(path) <5 : returnFalse
ifreverse_path[0:5] !="avaj.": returnFalse
defcompare_outputs():
ifcompare_files(Working_Directory.get("1.0", "end-1c") +"\op1.txt", Working_Directory.get("1.0", "end-1c") +"\op2.txt") ==False :
messagebox.showerror("Output Mismatch", "Output of both the codes does not match for the given test case")
else :
messagebox.showinfo("Output Match", "Output of both the codes match for the given test case")
Log1.config(state='normal')
Log1.delete('1.0', END)
Log1.insert(tk.END, "\t\tLog for Code 1 ")
Log1.insert(tk.END,"\n\t\t--------------")
Log1.insert(tk.END,"\n\n\tCompilation Time(s) :\t"+str(Compilation_time1))
Log1.insert(tk.END," \n\tExecution Time(s) :\t"+str(Execution_time1))
tot=str(Compilation_time1+Execution_time1)
Log1.insert(tk.END," \n\tTotal Time(s)\t\t : "+str(tot))
Log1.config(state='disable')
Log2.config(state='normal')
Log2.delete('1.0', END)
Log2.insert(tk.END, "\t\tLog for Code 2 ")
Log2.insert(tk.END, "\n\t\t--------------")
Log2.insert(tk.END, "\n\n\tCompilation Time(s) :\t"+str(Compilation_time2))
Log2.insert(tk.END, " \n\tExecution Time(s) :\t"+str(Execution_time2))
tot=str(Compilation_time2+Execution_time2)
Log2.insert(tk.END, " \n\tTotal Time(s)\t\t : "+str(tot))
Log2.config(state='disable')
defDebug():
#print(os.getpid())
globaldebug_flag
debug_flag=True
path=Working_Directory.get("1.0", "end-1c")
isFile=os.path.exists(path)
ifisFile==False:
messagebox.showinfo("Invalid Directory", "Please enter a valid working directory")
return
iflen(Language1.get()) ==0 :
messagebox.showinfo("Invalid Language", "Please enter a valid language for code1")
return
iflen(Language2.get()) ==0 :
messagebox.showinfo("Invalid Language", "Please enter a valid language for code2")
return
test_path=""
ifval3.get() ==0:
test_path=save_test_case()
#print(test_path)
elifval3.get() ==1:
test_path=Input_path.get("1.0", "end-1c")
elifval3.get() ==2:
ifLanguage3.get() =="Python"anddebug_flag==True:
code_path=Random_case.get("1.0", "end-1c")
if (check_validity_of_extension(code_path, "Python")) ==False:
messagebox.showerror("Extention-Language Mismatch", "In Random generator extension for Python must be .py")
return
run_python_code(code_path,"","test")
test_path=Working_Directory.get("1.0", "end-1c") +"\\test.txt"
ifLanguage3.get() =="CPP"anddebug_flag==True:
code_path=Random_case.get("1.0", "end-1c")
if (check_validity_of_extension(code_path, "CPP")) ==False:
messagebox.showerror("Extention-Language Mismatch", "In Random generator extension for CPP must be .cpp")
return
run_cpp_code(code_path,"","test")
test_path=Working_Directory.get("1.0", "end-1c") +"\\test.txt"
ifLanguage3.get() =="Java"anddebug_flag==True:
code_path=Random_case.get("1.0", "end-1c")
if (check_validity_of_extension(code_path, "Java")) ==False:
messagebox.showerror("Extention-Language Mismatch", "In Random generator extension for Java must be .java")
return
run_java_code(code_path,"","test")
test_path=Working_Directory.get("1.0", "end-1c") +"\\test.txt"
print(test_path)
ifLanguage1.get() =="Python"anddebug_flag==True:
code_path=save_python_code1()
if (check_validity_of_extension(code_path,"Python")) ==False :
messagebox.showerror("Extention-Language Mismatch", "In Code1 extension for Python must be .py")
return
run_python_code(code_path, test_path, "1")
ifLanguage1.get() =='CPP'anddebug_flag==True:
code_path=save_cpp_code1()
if (check_validity_of_extension(code_path,"CPP")) ==False :
messagebox.showerror("Extention-Language Mismatch", "In code1 extension for CPP must be .cpp")
return
run_cpp_code(code_path, test_path, "1")
ifLanguage1.get() =='Java'anddebug_flag==True:
code_path=save_java_code1()
if (check_validity_of_extension(code_path,"Java")) ==False :
messagebox.showerror("Extention-Language Mismatch", "In code1 extension for Java must be .java")
return
run_java_code(code_path, test_path, "1")
ifLanguage2.get() =="Python"anddebug_flag==True :
code_path=save_python_code2()
if (check_validity_of_extension(code_path,"Python")) ==False :
messagebox.showerror("Extention-Language Mismatch", "In code2 extension for Python must be .py")
return
run_python_code(code_path, test_path, "2")
ifLanguage2.get() =='CPP'anddebug_flag==True:
code_path=save_cpp_code2()
if (check_validity_of_extension(code_path,"CPP")) ==False :
messagebox.showerror("Extention-Language Mismatch", "In code2 extension for CPP must be .cpp")
return
run_cpp_code(code_path, test_path, "2")
ifLanguage2.get() =='Java'anddebug_flag==True:
code_path=save_java_code2()
if (check_validity_of_extension(code_path, "Java")) ==False:
messagebox.showerror("Extention-Language Mismatch", "In code2 extension for Java must be .java")
return
run_java_code(code_path, test_path, "2")
ifdebug_flag==True :
compare_outputs()
# frame / base layout
frame0=Frame(root, width=600, height=1700, bg='grey')
frame0.grid(row=0,column=0, padx=30 ,pady=5, sticky=NW)
frame1=Frame(root, width=600, height=1700, bg='grey')
frame1.grid(row=2,column=0, padx=30 ,pady=5, sticky=NW)
frame2=Frame(root, width=600, height=1700, bg='grey')
frame2.grid(row=1,column=0, padx=30 ,pady=5, sticky=NW)
frame3=Frame(root, width=100, height=1700, bg='grey')
frame3.grid(row=3,column=0, padx=30 ,pady=5, sticky=W)
frame4=Frame(root, width=100, height=1700, bg='grey')
frame4.grid(row=4,column=0, padx=30 ,pady=5, sticky=NW)
# Creating a photoimage object to use image
photo=PhotoImage(file=r"E:\untitled\browse.png")
# Resizing image to fit on button
photoimage=photo.subsample(15, 15)
# setting up the working directory
Label(frame0, text="Working Directory : ", bg='grey').grid(row=0, column=0, padx=5, pady=0, sticky=W)
Working_Directory=Text(frame0,height=1, width=154)
Working_Directory.grid(row=0, column=1, padx=5, pady=5, sticky=E)
Button(frame0, height=1, width=10, text="Browse", command=set_up_working_directory).grid(row=0, column=2, padx=5, pady=5, sticky=W)
Working_Directory.insert(tk.END, "C:\\Users\\DIPTAYAN BISWAS\\Desktop\\Code_Debugger")
# Editor for Code1
Radiobutton(frame1, text="Enter Code1 :", variable=val1, value=1, bg='grey', activebackground='grey', command=codconfig1).grid(row=0, column=0, padx=5, pady=5, sticky=NW)
scroll1=Scrollbar(frame1)
scroll1.grid(row=1, column=1, padx= (0,5), pady=6,ipady=136 , sticky=NW)
Code1=Text(frame1, height=20, width=87, bg='white', yscrollcommand=scroll1.set)
Code1.grid(row=1, column=0, padx=(10,0), pady=5, sticky=NW)
scroll1.config(command=Code1.yview)
# path for code 1
Radiobutton(frame2, text="Enter Path1 :", variable=val1, value=0, bg='grey', activebackground='grey', command=codconfig1).grid(row=0, column=0, padx=5, pady=0, sticky=W)
Path1=Text(frame2, height=1, width=72, state='disabled', bg='dim grey')
Path1.grid(row=0, column=1, padx=5, pady=5, sticky=W)
Button1=Button(frame2, image=photoimage,state='disabled', command=set_up_path1)
Button1.grid(row=0, column=2, padx=5, pady=5, sticky=W)
#Path1.insert(tk.END, "C:\\Users\\DIPTAYAN BISWAS\\Desktop\\Code_Debugger")
# Menu for Selecting language
Label(frame1 , text="\t\t\t\t Select Language : " , bg='grey').grid(row=0, column=0, padx=5, pady=5)
lang_menu1=ttk.Combobox(frame1, textvariable=Language1, values=['CPP', 'Python', 'Java'])
lang_menu1.grid(row=0, column=0, padx=60, pady=5, sticky=E)
lang_menu1.current(0)
# Editor For Code 2
scroll2=Scrollbar(frame1)
scroll2.grid(row=1, column=3, padx= (0,5), pady=6,ipady=136 , sticky=NW)
Radiobutton(frame1, text="Enter Code2 :", variable=val2, value=1, bg='grey', activebackground='grey', command=codconfig2).grid(row=0, column=2, padx=11, pady=5, sticky=NW )
Code2=Text(frame1, height=20, width=87,bg='white',yscrollcommand=scroll2.set)
Code2.grid(row=1, column=2, padx=(10,0), pady=5, sticky=NE)
scroll2.config(command=Code2.yview)
# OK button
#Button(frame1, height=1, width=10, text="OK", command=lambda: retrieve_input(Code2)).grid(row=2, column=1, padx=5, pady=5)
# path for code 2
Radiobutton(frame2, text="Enter Path2 :", variable=val2, value=0, bg='grey', activebackground='grey', command=codconfig2).grid(row=0, column=5, padx=5, pady=0, sticky=W)
Path2=Text(frame2, height=1, width=72, state='disabled', bg='dim grey')
Path2.grid(row=0, column=6, padx=5, pady=5, sticky=W)
Button2=Button(frame2, image=photoimage,state='disabled', command=set_up_path2)
Button2.grid(row=0, column=7, padx=5, pady=5, sticky=W)
#Path1.insert(tk.END, "C:\\Users\\DIPTAYAN BISWAS\\Desktop\\Code_Debugger")
# Menu for Selecting language
Label(frame1 , text="\t\t\t\tSelect Language: " , bg='grey').grid(row=0, column=2, padx=5, pady=5)
lang_menu2=ttk.Combobox(frame1, textvariable=Language2, values=['CPP', 'Python', 'Java'])
lang_menu2.grid(row=0, column=2, padx=60, pady=5, sticky=E)
lang_menu2.current(0)
# Custom Test Case
Radiobutton(frame3, text="Enter Custom Test: ", variable=val3, value=0, bg='grey', activebackground='grey', command=configtest).grid(row=0, column=0, padx=5, pady=5, sticky=NW)
scroll=Scrollbar(frame3)
scroll.grid(row=1, column=1, padx= (0,5), pady=6,ipady=16 , sticky=NW)
test=Text(frame3, height=5, width=96, yscrollcommand=scroll.set)
test.grid(row=1, column=0, padx=(10,0), pady=5, sticky=NE)
scroll.config(command=test.yview)
# path for input
Radiobutton(frame3, text="Enter Input file : ", variable=val3, value=1, bg='grey', activebackground='grey', command=configtest).grid(row=0, column=2, padx=5, pady=0, sticky=W)
Input_path=Text(frame3, height=1, width=76, bg='dim gray', state='disabled')
Input_path.grid(row=1, column=2, padx=5, pady=5, sticky=NW)
Buttontest=Button(frame3, image=photoimage,state='disabled', command=set_up_pathtest)
Buttontest.grid(row=1, column=3, padx=5, pady=5, sticky=NE)
#Path1.insert(tk.END, "C:\\Users\\DIPTAYAN BISWAS\\Desktop\\Code_Debugger")
# path for random case generator
Radiobutton(frame3, text="Genetate Test File : \t\tSelect Language :", variable=val3, value=2, bg='gray', activebackground='grey', command=configtest).grid(row=1, column=2, padx=5, sticky=W)
Random_case=Text(frame3,height=1, width=76, bg='dim gray', state='disabled')
Random_case.grid(row=1, column=2, padx=5, pady=5, sticky=SW)
Buttonrandom=Button(frame3, image=photoimage,state='disabled', command=set_up_pathrandom)
Buttonrandom.grid(row=1, column=3, padx=5, pady=5, sticky=SE)
# selecting language for random case generator
langg_menu=ttk.Combobox(frame3, textvariable=Language3, values=['CPP', 'Python', 'Java'],state='disabled')
langg_menu.grid(row=1, column=2, padx=150, pady=5, sticky=E)
langg_menu.current(0)
Button(frame3, height=1, width=10, text="Debug", command=Debug).grid(row=2, column=0, padx=100, pady=5,sticky=E)
Button(frame3, height=1, width=10, text="Clear", command=clear_all).grid(row=2, column=2, padx=0, pady=5,sticky=W)
# Showing log
Log1=Text(frame4,height=8, width=91, bg='dim gray')
Log1.grid(row=4, column=0, padx=5, pady=5)
Log1.config(state='disabled')
Log2=Text(frame4,height=8, width=91, bg='dim gray')
Log2.grid(row=4, column=1, padx=5, pady=5)
Log2.config(state='disabled')
root.mainloop()