Hi i need to open a python script using GUI. Is that possible to give the file path as command to the button? I tried with the below code, but it is showing No such file or directory. Please help
Thank you
import xlwt
from Tkinter import *
from tkFileDialog
import askopenfilename
def callback():
filename = ('C:\python\abc.py')
execfile(filename)
abc= Button(text='abc', command=callback)
abc.pack()
mainloop()
The backslash is the escape character, so you should escape it to make it mean “backslash the character” and not “backslash the escape character”. Try assigning
filenamelike this: