gpt4 book ai didi

python - Tkinter:在 Canvas 底部设置 0、0 坐标

转载 作者:太空宇宙 更新时间:2023-11-03 15:58:53 25 4
gpt4 key购买 nike

当我通常创建 Canvas 时,(0, 0) 坐标位于 Canvas 的左上角。现在我想将它设置在左下角。我想我必须设置“scrollbarregion”,但我不明白该怎么做。谁能解释一下?

最佳答案

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

来自official tcl/tk documentation on the canvas (tkinter 只是 tcl/tk 解释器的包装器):

COORDINATES

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.

TRANSFORMATIONS

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.

关于python - Tkinter:在 Canvas 底部设置 0、0 坐标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41652978/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com