【发布时间】:2019-06-10 19:05:12
【问题描述】:
我试图在下面的代码中调用变量 c。它说 cal 没有定义
def pay_cal():
def cal_fun():
t = Toplevel()
global cal
cal = Calendar(t, year=2019, month=6, day=1, foreground='Blue', background='White', selectmode='day')
cal.pack()
c = cal.get_date
sub_win =Tk()
sub_win.geometry('400x500+600+100')
sub_win.title('Payout Calculator')
l1 = Button(sub_win, text= 'Check-In Date:', command= cal_fun)
chck_in_date = Label(sub_win, textvariable= c )
l1.grid(row=1)
chck_in_date.grid(row=1, column=2)
【问题讨论】:
标签: python-3.x tkinter calendar nameerror nested-function