def tkbtn(fm, list): for btn in list: ##command指令对接的方法,不用lambda,则会立即执行,用了lambda,则会固话for循环的最后一个值,使用lambda name=name:def(name),来动态匹配 tk.Button(fm, text=btn, command=lambda btn=btn: sendMail(btn)).pack(side='left', fill='x', expand='yes') return tk.Button
def sched(option): day = getSvrOption('SchedulerDay', option) hour = getSvrOption('SchedulerHour', option) minute = getSvrOption('SchedulerMinute', option) scheduler = BackgroundScheduler() perTask = lambda option=option: sendMail(option) # perTask =lambda option=option:print(option) sched = scheduler.add_job(perTask, 'cron', day_of_week=day, hour=hour, minute=minute) return sched
def month(): sendMail('每月')
def weeklyThird(): sendMail('每周')
def weeklySec(): sendMail('每周已核对')
def weeklyFirst(): sendMail('每周提前')
def dailyThird(): sendMail('每日')
def dailySec(): sendMail('每日提前推送')
def dailyFirst(): sendMail('每日优先估值')