abb.py
import tkinter as tk
import acc
class Ae():
def init(self):
root = tk.Tk()
root.title(‘测试’)
self.worktime_v = tk.StringVar()
label_worktime = tk.Label(root,textvariable=self.worktime_v,width=30,anchor=tk.W)
label_worktime.grid(row=0,column=0,columnspan=3,padx=5,pady=2)
self.worktime_v.set('执行函数')
theButton = tk.Button(root,height=1,text='abb',command=self.perform)
theButton.grid(row=1,column=0,padx=5,pady=5,sticky=tk.W)
theButton2 = tk.Button(root,height=1,text='acc',command=lambda:why.test(self.worktime_v))
theButton2.grid(row=2,column=0,padx=5,pady=5,sticky=tk.W)
def perform(self):
self.worktime_v.set('执行abb.py本文件的函数')
why = acc.Tac()
if name == ‘main’:
face = Ae()
tk.mainloop()
acc.py
class Tac():
def test(self,worktime_v):
print(’::::::’)
print(worktime_v)
worktime_v.set(‘执行acc.py的函数’)