sizers in wxpanels/notebooks

A

Astan Chee

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
 
C

chaelon

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,226
Members
46,815
Latest member
treekmostly22

Latest Threads

Top