加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > Python > 正文

python – 在GTK中,如何在屏幕上获得小部件的实际大小?

发布时间:2020-12-16 23:35:00 所属栏目:Python 来源:网络整理
导读:首先,我查看了get_size_request方法.那里的文档以: To get the size a widget will actually use,call the size_request() instead of this method. 我查看size_request(),结束于 Also remember that the size request is not necessarily the size a widge
首先,我查看了get_size_request方法.那里的文档以:

To get the size a widget will actually use,call the size_request() instead of this method.

我查看size_request(),结束于

Also remember that the size request is not necessarily the size a widget will actually be allocated.

那么,GTK中是否有任何函数可以获得小部件的实际大小?这是一个屏幕上实际显示的小部件,因此GTK肯定会在某处提供此信息.

解决方法

这应该是它(花了一些时间才能找到):

The get_allocation() method returns a gtk.gdk.Rectangle containing the bounds of the widget’s allocation.

从here起.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读