FAQ
Hi,
I have a wxNoteBook with a bunch of wxPanels attached to it as pages.
Every page has its own GUI items.
What Im trying to do is on a certain page, a certain GUI (wxTextCtrl) to
be resized every time the notebook or panel is resized. But everything
else stays the same.
Now I know I can use sizers to solve this, but I have each GUI item's
position hard-coded and they shouldnt move around or change size. I was
thinking of putting this wxTextCtrl in a child wxPanel of these
wxPanel/pages. So the hierarchy is wxNoteBook -> wxPanel -> wxPanel ->
wxSizer.Add( wxTextCtrl)
is this possible? how do i get it working? are there other alternatives
to what Im trying to do? because simply putting a wxPanel in a wxPanel
and adding a sizer in a normal manner doesnt work for me.
below is a snippet of what Im doing (i dont want the button to change
position or change size or be in any sizers, but I do want the textctrl
to do so).

self.tab12 = wxPanel(self.notebook,-1)
self.s_test = wxButton(self.tab12,-1,"Clear",(20,20))
self.tab12_child = wxPanel(self.tab12,-1,(0,0),self.tab12.GetSize())
self.c_test =
wxTextCtrl(self.tab12_child,-1,"",(130,270),wxSize(800,350),style=wxTE_MULTILINE|wxHSCROLL|wxTE_RICH2|wxTE_RICH)
self.globalSizer = wx.BoxSizer(wxHORIZONTAL)
self.globalSizer.Add(self.c_test)
self.tab12.SetSizer(self.globalSizer)
self.globalSizer.SetSizeHints(self)

self.notebook.AddPage(self.tab12,"Test Sizers")


Thanks!
Astan

Search Discussions

  • Chaelon at Dec 8, 2007 at 7:21 am

    On Dec 7, 9:52 pm, Astan Chee wrote:
    Hi,
    I have a wxNoteBook with a bunch of wxPanels attached to it as pages.
    Every page has its own GUI items.
    What Im trying to do is on a certain page, a certain GUI (wxTextCtrl) to
    be resized every time the notebook or panel is resized. But everything
    else stays the same.
    Now I know I can use sizers to solve this, but I have each GUI item's
    position hard-coded and they shouldnt move around or change size. I was
    thinking of putting this wxTextCtrl in a child wxPanel of these
    wxPanel/pages. So the hierarchy is wxNoteBook -> wxPanel -> wxPanel ->
    wxSizer.Add( wxTextCtrl)
    is this possible? how do i get it working? are there other alternatives
    to what Im trying to do? because simply putting a wxPanel in a wxPanel
    and adding a sizer in a normal manner doesnt work for me.
    below is a snippet of what Im doing (i dont want the button to change
    position or change size or be in any sizers, but I do want the textctrl
    to do so).

    self.tab12 = wxPanel(self.notebook,-1)
    self.s_test = wxButton(self.tab12,-1,"Clear",(20,20))
    self.tab12_child = wxPanel(self.tab12,-1,(0,0),self.tab12.GetSize())
    self.c_test =
    wxTextCtrl(self.tab12_child,-1,"",(130,270),wxSize(800,350),style=wxTE_MULTILINE|wxHSCROLL|wxTE_RICH2|wxTE_RICH)
    self.globalSizer = wx.BoxSizer(wxHORIZONTAL)
    self.globalSizer.Add(self.c_test)
    self.tab12.SetSizer(self.globalSizer)
    self.globalSizer.SetSizeHints(self)

    self.notebook.AddPage(self.tab12,"Test Sizers")

    Thanks!
    Astan
    I don't get the need for self.tab12_child...You can just add the
    textctrl to
    a notebook directly, it will automatically fill the whole notebook
    page
    and resize as the notebook resizes. If instead you don't want it
    taking
    up the whole area of the notebook page, you'd put a self.tab12 as the
    page,
    then set the sizer on that panel, then add the notebook to that sizer.
    Don't
    know where the button is supposed to go. Beyond this, it is difficult
    to
    say what you should do as it is hard to picture this precisely from
    your
    description.

    I recommend you post wxPython questions to the wxPython list, which
    you can find a link for signing up to at the wxPython site,
    www.wxpython.org

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppython-list @
categoriespython
postedDec 8, '07 at 2:52a
activeDec 8, '07 at 7:21a
posts2
users2
websitepython.org

2 users in discussion

Astan Chee: 1 post Chaelon: 1 post

People

Translate

site design / logo © 2022 Grokbase