如何设置tkinter窗口(大小为500x500)的坐标,使(0,0)点在左下角,而(500x500)点在右上角?谷歌并没有提供太多帮助。在
def graphDisplay(distance, elevation):
'''draws up the graph.'''
#creates a window
root = Tk()
#sets the name of the window
root.title("Graph")
#sets the size of the window
root.geometry("500x500")
#sets the background of the window
root.configure(background='green')
#create a canvas object to draw the circle
canvas = Canvas(root)
#runs the program until you click x
root.mainloop
虽然你不能改变这一点,但很容易计算出你要找的东西。在
首先,我们必须注意,
x
坐标是相同的,即使0,0
位于画布的左下角或左上角,所以我们不必对此做任何操作。在但是
y
将发生变化,它将取决于画布的宽度。因此,首先,我们必须存储宽度并使用它来获得翻译后的y
值。在现在我们可以用这个宽度来计算,假设你想在}不会改变,我们必须翻译
^{pr2}$20,12
处添加一个点,画布是500,500
,那么{y
:相关问题 更多 >
编程相关推荐