I could add a row(StaticText + STC) to Autosizer in TestPanel by below method.
class TestPanel(wx.Panel):
def init(self, parent):
def OnAdd(self, event):
self.text = wx.StaticText(self, label='F')
self.editor = STC(self)
self.Autosizer.Add(self.text,0)
self.Autosizer.Add(self.editor,1, wx.EXPAND)
self.Layout()
and, I wanted to delete some added row by using sizer.Remove() method.
I am not sure whether this way is right but I tried it.
when I used self.parent.Autosizer.Remove(self.parent.stc1.GetId()) to remove a row,
there was no error but it deleted nothing.
so, I tried below:
self.parent.Autosizer.Remove(self.parent.text)
self.parent.Autosizer.Remove(self.parent.editor)
self.parent.Layout()
but there was no error and it deleted nothing.
it is in contentmenu class.
class MyPopupMenu(wx.Menu):
def init(self, parent):
super(MyPopupMenu, self).init()
self.parent = parent
mmi = wx.MenuItem(self, wx.NewId(), 'Remove')
self.AppendItem(mmi)
self.Bind(wx.EVT_MENU, self.OnRemove, mmi)
def OnRemove(self, e):
self.parent.Autosizer.Remove(self.parent.text)
self.parent.Autosizer.Remove(self.parent.editor)
self.parent.Layout()
self.parent is TestPanel in this code.
the calling structure was : TestPanel → STC(->MyPopupMenu), Autosizer
···
2011/10/19 C M cmpython@gmail.com
I did like this.
self.stc1.SetId(wx.NewId())
self.parent.Autosizer.Remove(self.parent.stc1.GetId())
self.parent.Layout()
but it didn’t work.
In order to get much better help on this list, you need to explain WHY
something didn’t work. There are various ways something doesn’t work:
It does nothing at all.
It does something other than what you wanted it to do.
An error is thrown.
So please let us know (and all times in the future) what the
specific problem is in this way.
One tip, though: Do you think these lines of yours should work?:
self.parent.Getparent()
self.parent.panel.Autosizer.Remove(0)
If not, why not? The point is, there is a fundamental point of Python
and programming generally that you are not seeing yet.
Che
–
To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com
or visit http://groups.google.com/group/wxPython-users?hl=en
