所以我想在窗口底部放置一个矩形。如何找到正确的 y 坐标?我的窗口是全屏打开的,所以 y 坐标并不总是相同的。
由于我对 python 使用的数学不太了解,而且有时我会为我的问题找到奇怪的解决方案,所以我尝试使用整数。当然,我用谷歌搜索了我的问题,但找不到有效的解决方案。
from tkinter import *
def run(): #I define it, so I can import it and use it in other files.
w=Tk()
w.state('zoomed')
w.title('A title')
bg=Canvas(w,bg='#808080',borderwidth=0,highlightthickness=0)
bg.pack(fill='both',expand=True)
ywindow=w.winfo_screenheight()
yfooter=ywindow-30
footer=Canvas(w,bg='#A5A5A5',borderwidth=2,highlightthickness=0)
footer.place(height=30,width=w.winfo_screenwidth(),x=0,y=yfooter)
run()
我希望 tkinter 使用距离边界 30 像素的坐标作为 y,但它根本没有显示Canvas
。