[wxPython-users] Question about wx.NoteBook

甜瓜 littlesweetmelon at gmail.com
Sat Sep 15 21:38:32 PDT 2007


Today, I feel a little inconvenient in fitting pages in wx.NoteBook.
xrc structure is listed below:
wxFrame "MainFrame"
|__BoxSizer
    |__wxPanel
        |__BoxSizer
            |__wxNoteBook
            ......

wxPanel "PageOne"
|__BoxSizer "#1"
    |__wxPanel "#2 Just for making borders"
        |__FlexGridSizer ("3 cols, many rows")
            |__ EditBox "Some input field"
            |__ EditBox "Some input field"
            |__ EditBox "Some input field"
            .....

I want to add "PageOne" into the wxNoteBook in "MainFrame". This code
is written in MainFrame.__init__:
        self.note_book.AddPage(page_one, "Tab1")
When the mainframe shows, the note_book does not follow the size of
PageOne, so serveral widgets in PageOne are clipped by note_book.
To fix this problem, I explicitly calls:
        self.NOTE_AD.Fit()
        self.Fit()
But wxNoteBook document says it can fit the pages automatically. Is
there something wrong with my code?

Another problem is about "border". Previously, my xrc does not have
"#1" & "#2" items. When "PageOne" is added to note_book, left or top
widgets align VERY NEAR the edge which lead to aesthetic problem. ^_^
Moreover, there is no way to set border size on "PageOne" directly,
because: 1. GetWindowBorderSize exists while SetWindowBorderSize  not;
2."PageOne" is at one of the roots of xrc tree, no "border" input area
on xrced GUI. My workaround is add "#1" and "#2". Now "#2" has
"border" input area. @_@

Is there any better way to do that? Thank you.

---
ShenLei




More information about the wxpython-users mailing list