The size_request() method returns the
preferred size of a widget as a tuple
containing its required width and
height. This method is typically used
when implementing a gtk.Container
subclass to arrange the container's
child widgets and decide what size
allocations to give them with the
size_allocate() method. Obtaining a
size request requires that the widget
be associated with a screen, because
font information may be needed.
Also remember that the size request is
not necessarily the size a widget will
actually be allocated.
您可能正在寻找get_allocation方法:
或size_request:
后者是小部件希望拥有的大小(给定字体信息),前者是在布局小部件时由其容器实际给定的大小。你知道吗
相关问题 更多 >
编程相关推荐