def _tk_redraw_canvas(self, width, height):
if self._canvas:
self._canvas.destroy()
self._fnormal = Font(family='Monospace', size=13)
self._fbold = Font(family='Monospace', weight='bold', size=13)
self._fitalic = Font(family='Monospace', slant='italic', size=13)
self._fbolditalic = Font(family='Monospace', weight='bold',
slant='italic', size=13)
self._colsize = self._fnormal.measure('A')
self._rowsize = self._fnormal.metrics('linespace')
self._canvas = Canvas(self._root, width=self._colsize * width,
height=self._rowsize * height)
self._tk_fill_region(0, height - 1, 0, width - 1)
self._cursor_row = 0
self._cursor_col = 0
self._scroll_top = 0
self._scroll_bot = height - 1
self._scroll_left = 0
self._scroll_right = width - 1
self._width, self._height = (width, height,)
self._canvas.pack()
评论列表
文章目录