Skip to content

Commit 045c353

Browse files
committed
GUI compatible with py3
1 parent 1a7a120 commit 045c353

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

pdf_audio_GUI.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,20 @@
11
#dependencies
2-
from Tkinter import *
3-
import tkFileDialog
2+
# for python 3
3+
from tkinter import *
4+
from tkinter import filedialog
45
import PyPDF2
56
import pyttsx3
67

8+
# for python 2 uncomment the following and comment the above one
9+
# from Tkinter import *
10+
# import tkFileDialog #change tkFileDialog in line 17
11+
# import PyPDF2
12+
# import pyttsx3
713

814

915
def extract_text():
1016
'''To extract text from chosen PDF file'''
11-
file = tkFileDialog.askopenfile(parent=root, mode='rb', title='Choose a PDF file')
17+
file = filedialog.askopenfile(parent=root, mode='rb', title='Choose a PDF file')
1218
if file != None:
1319
pdfReader = PyPDF2.PdfFileReader(file)
1420
global mytext

0 commit comments

Comments
 (0)