-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathtroybin2troy_gui.py
More file actions
executable file
·25 lines (23 loc) · 913 Bytes
/
troybin2troy_gui.py
File metadata and controls
executable file
·25 lines (23 loc) · 913 Bytes
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
#!/bin/env python
import sys
import os
import time
from lolpytools.convert import troybin2troy
from tkinter import filedialog
from tkinter import *
root = Tk()
root.title="troybin converter"
root.withdraw()
inname = filedialog.askopenfilename(title = "Open.troybin file", filetypes = (("troybin files","*.troybin"),("all files","*.*")))
if os.path.isfile(inname):
defoutname = os.path.basename(inname)
print(defoutname)
if defoutname.endswith(".troybin"):
defoutname = defoutname.replace('.troybin', '.troy')
else:
defoutname = defoutname + '.troybin'
outname = filedialog.asksaveasfilename(title = "Save .troy file", initialfile=defoutname, filetypes = (("troy files","*.troy"),("all files","*.*")))
with open(inname, 'rb') as infile:
with open(outname, 'w', encoding='utf-8', newline='\r\n') as outfile:
troybin2troy(infile, outfile)
root.destroy()