Tkinter:在画布底部设置 0, 0 坐标 [英] Tkinter: Set 0, 0 coords on the bottom of a canvas

查看:63
本文介绍了Tkinter:在画布底部设置 0, 0 坐标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我通常创建画布时,(0, 0) 坐标位于它的左上角.现在我想把它设置在左下角.我想我必须设置滚动条区域",但我不明白该怎么做.谁能解释一下?

When I usually create a canvas, the (0, 0) coord is place on the top left corner of it. Now I want to set it on the bottom left corner. I think I have to set the "scrollbarregion" but I can't understand how to do it. Can someone explain?

推荐答案

tkinter 画布不支持更改坐标系.您可以滚动画布,使 0,0 出现在左下角,但这不会影响坐标系.点 (1,1) 将始终位于点 (0,0) 的右侧和下方.

The tkinter canvas does not support changing the coordinate system. You can scroll the canvas so that 0,0 appears in the bottom left corner, but that won't affect the coordinate system. Point (1,1) will always be to the right and below the point (0,0).

来自画布上的官方 tcl/tk 文档(tkinter 只是一个 tcl/tk 解释器的包装器):

From the official tcl/tk documentation on the canvas (tkinter is just a wrapper around a tcl/tk interpreter):

坐标

所有与画布相关的坐标都存储为浮点数.坐标和距离以屏幕单位指定,它们是浮点数,可选择后跟几个字母之一.如果未提供字母,则距离以像素为单位.如果字母是 m,则距离在屏幕上以毫米为单位;如果是 c 则距离以厘米为单位;i 表示英寸,p 表示打印机点数(1/72 英寸).较大的 y 坐标是指屏幕上较低的点;较大的 x 坐标是指更靠右的点.坐标可以指定为偶数个参数,也可以指定为包含偶数个 x 和 y 坐标值的单个列表参数.

All coordinates related to canvases are stored as floating-point numbers. Coordinates and distances are specified in screen units, which are floating-point numbers optionally followed by one of several letters. If no letter is supplied then the distance is in pixels. If the letter is m then the distance is in millimeters on the screen; if it is c then the distance is in centimeters; i means inches, and p means printers points (1/72 inch). Larger y-coordinates refer to points lower on the screen; larger x-coordinates refer to points farther to the right. Coordinates can be specified either as an even number of parameters, or as a single list parameter containing an even number of x and y coordinate values.

转型

通常画布坐标系的原点位于包含画布的窗口的左上角.可以使用 xview 和 yview 小部件命令相对于窗口原点调整画布坐标系的原点;这通常用于滚动.画布不支持相对于窗口坐标系缩放或旋转画布坐标系.

Normally the origin of the canvas coordinate system is at the upper-left corner of the window containing the canvas. It is possible to adjust the origin of the canvas coordinate system relative to the origin of the window using the xview and yview widget commands; this is typically used for scrolling. Canvases do not support scaling or rotation of the canvas coordinate system relative to the window coordinate system.

这篇关于Tkinter:在画布底部设置 0, 0 坐标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆