官术网_书友最值得收藏!

There's more…

Another important advantage of the Place geometry manager is that it may be used in conjunction with Pack or Grid.

For instance, imagine that you want to dynamically display a caption over a widget when you right-click on it. You can represent this caption with a Label widget, which gets placed in the relative position where you clicked on the widget:

def show_caption(self, event):
caption = tk.Label(self, ...)
caption.place(in_=event.widget, x=event.x, y=event.y)
# ...

As general advice, we recommend that you use any of the other geometry managers as much as possible in your Tkinter applications and leave this only for those specialized cases where you need a custom positioning.

主站蜘蛛池模板: 荣昌县| 定安县| 达孜县| 广东省| 高密市| 西平县| 黑山县| 澜沧| 大悟县| 集贤县| 古浪县| 黎平县| 鸡东县| 白玉县| 和顺县| 琼结县| 长阳| 北碚区| 太仆寺旗| 镇原县| 兰西县| 重庆市| 多伦县| 原阳县| 阿拉尔市| 星子县| 商水县| 五华县| 大足县| 曲阜市| 冷水江市| 宁海县| 肥城市| 民县| 团风县| 南宁市| 桂东县| 浦县| 信阳市| 明光市| 理塘县|