| 2459 | self.buttonBox() |
| 2460 | |
| 2461 | def buttonBox(self): |
| 2462 | # add standard button box. override if you don't want the |
| 2463 | # standard buttons |
| 2464 | |
| 2465 | box = tkinter.Frame(self) |
| 2466 | |
| 2467 | w = tkinter.Button(box, text="Dismiss", width=10, command=self.onDismiss, default=tkinter.ACTIVE) |
| 2468 | w.grid(row=1, column=1, padx=5, pady=5) |
| 2469 | |
| 2470 | self.bind("<Return>", self.onDismiss) |
| 2471 | self.bind("<Escape>", self.onDismiss) |
| 2472 | |
| 2473 | box.grid(row=2, column=1) |
| 2474 | |
| 2475 | def onDismiss(self, event=None): |
| 2476 | # put focus back to the parent window's canvas |