**this is my main file:**
ExcelAppl = win32com.client.Dispatch('Excel.Application')
Workbook = ExcelAppl.Workbooks.Open('excel file path')
Sheet = Workbook.Worksheets.Item(1)
Sheet1 = Workbook.Worksheets.Item(2)
**this is the Python gui:**
from Tkinter import *
from tkMessageBox import *
from tkColorChooser import askcolor
import tkFileDialog
import MainLibrary
root = Tk()
root.title("Chrysler Test Framework")
root.geometry("800x500")
def callback():
file_path = tkFileDialog.askopenfilename(filetypes=[("Excel files","*.xls")])
print "the file path %s",file_path
Text_button.insert(INSERT,file_path)
MainLibrary.second(str(file_path))
def execute():
execfile("MainLibrary.py")
Browse_button = Button(text='Browse', command=callback).pack(side=LEFT, padx=10, pady=20, ipadx=20, ipady=10)
Execution_button = Button(text='Convert', command=execute).pack(side=BOTTOM, padx=10, pady=20, ipadx=20, ipady=10)
def quit():
root.destroy()
quit_button = Button( text='Goodbye!',command=quit, padx = 20).pack(side=RIGHT, padx=10, pady=20, ipadx=20, ipady=10)
root.mainloop()
This is my query.I need to get the file_path from the GUI and assign it to the (Workbook = ExcelAppl.Workbooks.Open('excel file path').Can you let me know how to do it.
racigan 0 Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.