Python 在tkinter中设置对象坐标

Python 在tkinter中设置对象坐标,python,user-interface,python-3.x,tkinter,Python,User Interface,Python 3.x,Tkinter,我正在使用tkinter,但我找不到设置对象坐标的方法。在python文档中,只提到了side的使用。有没有办法在窗口中说出对象的左上方? 例如: import tkinter from tkinter.constants import * tk = tkinter.Tk() frame = tkinter.Frame(tk, relief=RIDGE, borderwidth=2) frame.pack(fill=BOTH,expand=1) label = tkinter.Label(fra

我正在使用tkinter,但我找不到设置对象坐标的方法。在python文档中,只提到了side的使用。有没有办法在窗口中说出对象的左上方? 例如:

import tkinter
from tkinter.constants import *
tk = tkinter.Tk()
frame = tkinter.Frame(tk, relief=RIDGE, borderwidth=2)
frame.pack(fill=BOTH,expand=1)
label = tkinter.Label(frame, text="Hello, World")
label.pack(fill=X, expand=1)
button = tkinter.Button(frame,text="Exit",command=tk.destroy)#here I need to put my button at left=0,top=10 !!!
button.pack(side=BOTTOM)
tk.mainloop()
使用
place()
代替
pack()
。但是不要同时在同一个
框架中使用
pack()
grid()
place()
。当然,您可以(例如)在父
Frame
中使用
pack()
,在子
Frame
中使用
grid()

见: