how to use listctrl in notebook wxPython
Posted
by
???
on Stack Overflow
See other posts from Stack Overflow
or by ???
Published on 2013-11-04T15:24:36Z
Indexed on
2013/11/04
15:54 UTC
Read the original article
Hit count: 211
wxpython
I have one question.. wxPython listctrl in notebook
I created 2 tab use notebook.
I added button in first tab and added Listctrl in second tab.
If i click the button, Add value in Listctrl to second tab. how to solve this problem?
import wx
class PageOne(wx.Panel):
def __init__(self, parent):
wx.Panel.__init__(self, parent)
self.query_find_btn = wx.Button(self, 4, "BTN", (40,40))
self.Bind(wx.EVT_BUTTON, self.AddList, id = 4)
def AddList(self, evt):
self.list1.InsertStringItem(0,'Hello')
class PageTwo(wx.Panel):
def __init__(self, parent):
wx.Panel.__init__(self, parent)
self.list1 = wx.ListCtrl(self,-1,wx.Point(0,0),wx.Size(400,400),style=wx.LC_REPORT | wx.SUNKEN_BORDER)
self.list1.InsertColumn(0,'values')
class MyFrame(wx.Frame):
def __init__(self, parent, id, title):
wx.Frame.__init__(self,parent,id,title,size=(400,400),pos=wx.Point(100,100),
style=wx.SYSTEM_MENU |wx.CAPTION )
p = wx.Panel(self)
nb = wx.Notebook(p)
MainFrame = PageOne(nb)
SecondFrame = PageTwo(nb)
nb.AddPage(MainFrame, "One")
nb.AddPage(SecondFrame, "Two")
sizer = wx.BoxSizer()
sizer.Add(nb, 1, wx.EXPAND)
p.SetSizer(sizer)
class MyApp(wx.App):
def OnInit(self):
self.frame=MyFrame(None,-1,'Unknown.py')
self.frame.Centre()
self.frame.Show()
return True
if __name__ == '__main__':
app = MyApp(False)
app.MainLoop()
© Stack Overflow or respective owner