| 331 | using turtle graphics functions or the Turtle class. |
| 332 | """ |
| 333 | def __init__(self, master, width=500, height=350, |
| 334 | canvwidth=600, canvheight=500): |
| 335 | TK.Frame.__init__(self, master, width=width, height=height) |
| 336 | self._rootwindow = self.winfo_toplevel() |
| 337 | self.width, self.height = width, height |
| 338 | self.canvwidth, self.canvheight = canvwidth, canvheight |
| 339 | self.bg = "white" |
| 340 | self._canvas = TK.Canvas(master, width=width, height=height, |
| 341 | bg=self.bg, relief=TK.SUNKEN, borderwidth=2) |
| 342 | self.hscroll = TK.Scrollbar(master, command=self._canvas.xview, |
| 343 | orient=TK.HORIZONTAL) |
| 344 | self.vscroll = TK.Scrollbar(master, command=self._canvas.yview) |
| 345 | self._canvas.configure(xscrollcommand=self.hscroll.set, |
| 346 | yscrollcommand=self.vscroll.set) |
| 347 | self.rowconfigure(0, weight=1, minsize=0) |
| 348 | self.columnconfigure(0, weight=1, minsize=0) |
| 349 | self._canvas.grid(padx=1, in_ = self, pady=1, row=0, |
| 350 | column=0, rowspan=1, columnspan=1, sticky='news') |
| 351 | self.vscroll.grid(padx=1, in_ = self, pady=1, row=0, |
| 352 | column=1, rowspan=1, columnspan=1, sticky='news') |
| 353 | self.hscroll.grid(padx=1, in_ = self, pady=1, row=1, |
| 354 | column=0, rowspan=1, columnspan=1, sticky='news') |
| 355 | self.reset() |
| 356 | self._rootwindow.bind('<Configure>', self.onResize) |
| 357 | |
| 358 | def reset(self, canvwidth=None, canvheight=None, bg = None): |
| 359 | """Adjust canvas and scrollbars according to given canvas size.""" |