-2

I would like two put these two command in one button. I use for loop, to generate grid buttons.

PC=Button(pc_area, text='RESERVE').pack()
PC['command'] = lambda PC=PC:reserve_confirmation(PC)
PC['command'] = lambda x=line: func(x)
shammeee
  • 1
  • 3
  • PC is `None` as `pack()` returns `None`. So instantiate `Button` in one line and then pack it in another. To call multiple event handlers use `Button(root, command=lambda :fun1() or fun2())` – JacksonPro Jan 05 '21 at 06:46

1 Answers1

0

I try this and it works.

PC['command'] = lambda PC=PC,x=line:[reserve_confirmation(PC),func(x)]
10 Rep
  • 2,217
  • 7
  • 19
  • 33
shammeee
  • 1
  • 3