开发者

How to layout all children of a wxPanel?

I have a wxPython application which allows the users to select items from menus that then change what is visible on the screen. This often requires a recalculation of the layout of panels. I'd like to be able to call the layout of all the children of a panel (and the children of those children) in reverse order. That is, the items with no children have their Layout() function called first, then their paren开发者_如何学运维ts, and so on.

Otherwise I have to keep all kinds of knowledge about the parents of panels in the codes. (i.e. how many parents will be affected by a change in this-or-that panel).


More in response to your comment to Jon Cage's answer, than to your original question (which was perfectly answered by Jon):

The user might find it irritating, if the position of every element in your dialog changes, when he makes a choice. Maybe it'll look better, if only the "variable part" is updated. To achieve this, you could make a panel for each set of additional controls. The minimum size of each panel should be the minimum size of the largest of these panels. Depending on the user's choice you can hide or show the desired panel.

Alternatively, wxChoicebook might be what you need?


Have a look at wxSizers and some examples for a fluid way to layout forms.

You can specify heights, poportions etc. etc. and then let the layout code do the rest for you :)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜