| 232 | using turtle graphics functions or the Turtle class. |
| 233 | """ |
| 234 | def __init__(self, master, width=500, height=350, |
| 235 | canvwidth=600, canvheight=500): |
| 236 | TK.Frame.__init__(self, master, width=width, height=height) |
| 237 | self._rootwindow = self.winfo_toplevel() |
| 238 | self.width, self.height = width, height |
| 239 | self.canvwidth, self.canvheight = canvwidth, canvheight |
| 240 | self.bg = "white" |
| 241 | self._canvas = TK.Canvas(master, width=width, height=height, |
| 242 | bg=self.bg, relief=TK.SUNKEN, borderwidth=2) |
| 243 | self.hscroll = TK.Scrollbar(master, command=self._canvas.xview, |
| 244 | orient=TK.HORIZONTAL) |
| 245 | self.vscroll = TK.Scrollbar(master, command=self._canvas.yview) |
| 246 | self._canvas.configure(xscrollcommand=self.hscroll.set, |
| 247 | yscrollcommand=self.vscroll.set) |
| 248 | self.rowconfigure(0, weight=1, minsize=0) |
| 249 | self.columnconfigure(0, weight=1, minsize=0) |
| 250 | self._canvas.grid(padx=1, in_ = self, pady=1, row=0, |
| 251 | column=0, rowspan=1, columnspan=1, sticky='news') |
| 252 | self.vscroll.grid(padx=1, in_ = self, pady=1, row=0, |
| 253 | column=1, rowspan=1, columnspan=1, sticky='news') |
| 254 | self.hscroll.grid(padx=1, in_ = self, pady=1, row=1, |
| 255 | column=0, rowspan=1, columnspan=1, sticky='news') |
| 256 | self.reset() |
| 257 | self._rootwindow.bind('<Configure>', self.onResize) |
| 258 | |
| 259 | def reset(self, canvwidth=None, canvheight=None, bg = None): |
| 260 | """Adjust canvas and scrollbars according to given canvas size.""" |