Re: Unusable outer edge of Tkinter canvases?
- From: "Fredrik Lundh" <fredrik@xxxxxxxxxxxxxx>
- Date: Wed, 25 May 2005 18:14:08 +0200
Dave Opstad wrote:
> When drawing rectangles in Tkinter canvases I've noticed the outer edges
> (say 3-5 pixels) don't always draw. For instance, try typing this in an
> interactive session (Terminal in OS X or Command Prompt in Windows XP):
>
> >>> import Tkinter as T
> >>> root = T.Tk()
> >>> f = T.Frame(root)
> >>> f.grid()
> >>> c = T.Canvas(f, width = 300, height = 300)
> >>> c.grid()
> >>> c.create_rectangle(1, 1, 299, 299)
> >>> c.create_rectangle(3, 3, 297, 297)
> >>> c.create_rectangle(5, 5, 295, 295)
>
> On the Mac, the first two rectangles only partly show up (two sides for
> the first one and three for the second), while the third one draws
> completely. On Windows the first rectangle appears partially and the
> final two appear completely.
>
> Is there some simple setting I'm missing? I've tried gridding the canvas
> with padx, pady and also ipadx, ipady values but nothing seems to help
> make the whole rectangle (1, 1, 299, 299) appear.
by default, the coordinate system is aligned with the widget's upper
left corner, which means that things you draw will be covered by the
inner border.
to fix this, you can either set the border width to zero, add scrollbars
to the widget (this fixes the coordinate system), or explicitly reset the
coordinate system:
w.xview_moveto(0)
w.yview_moveto(0)
</F>
.
- Follow-Ups:
- Re: Unusable outer edge of Tkinter canvases?
- From: Dave Opstad
- Re: Unusable outer edge of Tkinter canvases?
- References:
- Unusable outer edge of Tkinter canvases?
- From: Dave Opstad
- Unusable outer edge of Tkinter canvases?
- Prev by Date: RE: Build error Python 2.4.1 - stat problem?
- Next by Date: Re: IRIX MipsPro compiler chokes on Python.h
- Previous by thread: Unusable outer edge of Tkinter canvases?
- Next by thread: Re: Unusable outer edge of Tkinter canvases?
- Index(es):
Relevant Pages
|
Loading