-
Notifications
You must be signed in to change notification settings - Fork 0
/
word2pdf.py
28 lines (24 loc) · 909 Bytes
/
word2pdf.py
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
from main import *
import os
import PySimpleGUI as sg
### Imports ####
def main():
Layout = [ [sg.Text('Hello From PDF converter, Please Provide the .docx to convert to .PDF')] ,
[sg.Input(key='file_path'), sg.FileBrowse()],
[sg.Checkbox('Open the converted file in the default PDF viewer', key='open', default=False)],
[sg.OK(), sg.Cancel()]]
window = sg.Window('PDF Converter', layout=Layout)
while True:
event, values = window.read()
if event in (None, 'Cancel', sg.WINDOW_CLOSED):
break
elif event in ('OK'):
file_path = os.path.normpath(values['file_path'])
make_pdf_(file_path, open_=values['open'])
sg.popup('pdf made !')
break
else:
sg.popup('An Error Occoured')
break
if __name__ == "__main__":
main()