-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathatg_import.py
34 lines (24 loc) · 995 Bytes
/
atg_import.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
29
30
31
32
33
from tkinter import *
from tkinter import filedialog
import tkSimpleDialog
class ATG_Import(tkSimpleDialog.Dialog):
def body(self, master):
self.option = StringVar(master)
self.option.set("Address")
self.menu = OptionMenu(master, self.option, "Address", "Data", "Mask", "Control")
self.menu.grid(row=0, sticky=E)
self.file = StringVar(master)
self.fileentry = Entry(master, textvariable=self.file)
self.fileentry.grid(row=0, column=1)
self.browse = Button(master, text='Browse...', command=self.browse_cb)
self.browse.grid(row=0, column=2, padx=20)
return self.menu
def browse_cb(self):
filename=filedialog.askopenfilename(defaultextension='.coe')
self.file.set(filename)
def apply(self):
self.result = {'column': self.option.get().lower(), 'filename': self.file.get()}
if __name__ == '__main__':
root = Tk()
ATG_Import(root, 'File import')
root.mainloop()