python - how to link a button to another .py file in python2.7 -
how link python button?
basically want python button execute python file.
i using tk.
i've created button , execute script
from tkinter import * import tkinter tk root = tk.tk() b = button(toolbar, text="travelling", width=9 ) b.pack(side=left, padx=2, pady=2) mainloop() how make button execute python script on click?
if want execute python script use execfile():
#-*- coding: utf-8 -*- tkinter import * master = tk() def callback(): execfile("script.py") b = button(master, text="ok", command=callback) b.pack() mainloop()
Comments
Post a Comment