python tkinter 窗口嵌套,如何在python tkinter中重叠窗口小部件/框架?

在Python tkinter中创建一个Text字段,并在右下角放置一个小型信息框,可以利用place几何管理器来实现。通过设置相对坐标和尺寸,可以将信息框置于Text字段之上,作为滚动时的提示窗口。具体实现包括创建Text对象、垂直滚动条,以及在Text下方定位信息标签。
摘要由CSDN通过智能技术生成

I was wondering if this is even possible. My goal is to have a small white box in the bottom right hand corner, on top of a larger text field. The white box will be used as an "info box" while the person scrolls through the text inside of the text field.

When I say "text field" I mean Text from tkinter.

解决方案

The way to place one widget on top of other widgets is to use the place geometry manager. You can specify an x/y coordinate relative to some other widget, as well as to specify either absolute or relative widths and heights.

The effbot site has a decent writeup on the place geometry manager: http://effbot.org/tkinterbook/place.htm

Here's a simple example:

import Tkinter as tk

class Example(tk.Frame):

def __init__(self, parent):

tk.Frame.__init__(self, parent)

self.text = tk.Text(self, wrap&

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值