wxpython的sizer_wxpython sizer

item - The item can be one of three kinds of objects:

window: A wx.Window to be managed by the sizer. Its minimal size (either set explicitly by the user or calculated internally when constructed with wx.DefaultSize) is interpreted as the minimal size to use when laying out item in the sizer. This is particularly useful in connection with wx.Window.SetSizeHints.

sizer: The (child-)sizer to be added to the sizer. This allows placing a child sizer in a sizer and thus to create hierarchies of sizers (for example a vertical box as the top sizer and several horizontal boxes on the level beneath).

size: A wx.Size or a 2-element sequence of integers that represents the width and height of a spacer to be added to the sizer. Adding spacers to sizers gives more flexibility in the design of dialogs; imagine for example a horizontal box with two buttons at the bottom of a dialog: you might want to insert a space between the two buttons and make that space stretchable using the proportion value and the result will be that the left button will be aligned with the left side of the dialog and the right button with the right side - the space in between will shrink and grow with the dialog.

proportion - Although the meaning of this parameter is undefined in wx.Sizer, it is used in wx.BoxSizer to indicate if a child of a sizer can change its size in the main orientation of the wx.BoxSizer - where 0 stands for not changeable and a value of more than zero is interpreted relative (a proportion of the total) to the value of other children of the same wx.BoxSizer. For example, you might have a horizontal wx.BoxSizer with three children, two of which are supposed to change their size with the sizer. Then the two stretchable windows should each be given proportion value of 1 to make them grow and shrink equally with the sizer's horizontal dimension. But if one of them had a proportion value of 2 then it would get a double share of the space available after the fixed size items are positioned.

(type=int)

flag - This parameter can be used to set a number of flags which can be combined using the binary OR operator |. Two main behaviours are defined using these flags. One is the border around a window: the border parameter determines the border width whereas the flags given here determine which side(s) of the item that the border will be added. The other flags determine how the sizer item behaves when the space allotted to the sizer changes, and is somewhat dependent on the specific kind of sizer used.

wx.TOP

wx.BOTTOM

wx.LEFT

wx.RIGHT

wx.ALL

These flags are used to specify which side(s) of the sizer item that the border width will apply to.

wx.EXPAND

The item will be expanded to fill the space allotted to the item.

wx.SHAPED

The item will be expanded as much as possible while also maintaining its aspect ratio

wx.FIXED_MINSIZE

Normally wx.Sizers will use wx.Window.GetMinSize or wx.Window.GetBestSize to determine what the minimal size of window items should be, and will use that size to calculate the layout. This allows layouts to adjust when an item changes and it's best size becomes different. If you would rather have a window item stay the size it started with then use wx.FIXED_MINSIZE.

wx.ALIGN_CENTER

wx.ALIGN_LEFT

wx.ALIGN_RIGHT

wx.ALIGN_TOP

wx.ALIGN_BOTTOM

wx.ALIGN_CENTER_VERTICAL

wx.ALIGN_CENTER_HORIZONTAL

The wx.ALIGN flags allow you to specify the alignment of the item within the space allotted to it by the sizer, ajusted for the border if any.

(type=int)

border - Determines the border width, if the flag parameter is set to include any border flag.

(type=int)

userData - Allows an extra object to be attached to the sizer item, for use in derived classes when sizing information is more complex than the proportion and flag will allow for.

(type=PyObject)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值