views:

73

answers:

1
  1. How to change only hight of an object in wxPython, leaving its width automatic? In my case it's a TextCtrl.

  2. How to make the height of the window available for change and lock the width?

+4  A: 

For the width or height to be automatically determined based on context you use for it the value of -1, for example (-1, 100) for a height of 100 and automatic width.

The default size for all controls is usually (-1, -1).

If a width or height is specified and the sizer item for the control doesn't have wx.EXPAND flag set (note that even if this flag is set some sizers won't expand in both directions by default) you might call it "locked" as it won't chage that dimension.

Make sure to study the workings of sizers in depth as it is one of the most important things in GUI design.

Toni Ruža