关于网友提出的“wxpython SplitterWindow panel 刷新后不能正确显示的问题?”问题疑问,本网通过在网上对“wxpython SplitterWindow panel 刷新后不能正确显示的问题?”有关的相关答案进行了整理,供用户进行参考,详细问题解答如下:
问题:wxpython SplitterWindow panel 刷新后不能正确显示的问题?
描述:现在用wxpython 做联系人应用,
希望实现点击左侧联系人列表刷新右侧联系人信息
现在使用了wx.SplitterWindow, ReplaceWindow(winOld, winNew)
现在点击实现了替换,返回了True 。但是替换后不能在右侧显示。
SplitterWindow 部分代码:
class SplitterContacts(wx.SplitterWindow):
def __init__(self, parent, ID):
wx.SplitterWindow.__init__(self, parent, ID,
style = wx.SP_LIVE_UPDATE)
self.sp = wx.SplitterWindow(self)
self.InitSplitter()
def InitSplitter(self):
self.SetSize((500, 500))
style = wx.BORDER_SUNKEN
with open('contacts.json', 'r') as contacts:
contacts = contacts.read()
contacts = json.loads(contacts)
contact = contacts.values()[0]
left_list = wx.Panel(self, style=style)
left_list = ListContactsPanel(self, style=style, c
left_list.SetBackgroundColour("sky blue")
right_list = ContactDetail(self, style=style, c
right_list.SetBackgroundColour("pink")
self.SetMinimumPaneSize(200)
self.SplitVertically(left_list, right_list, -400)
点击响应事件 处理
def OnColClick(self, evt):
i = evt.GetIndex()
contact = self.contacts.values()[i]
left = self.parent.GetWindow1()
old = self.parent.GetWindow2()
old.SetBackgroundColour("blue")
style = wx.BORDER_SUNKEN
new = ContactDetail(self, style=style, c
self.parent.ReplaceWindow(old, new)
old.Destroy()
new.Show(True)
不知道哪里出了错误!
请教一下
谢谢!
解决方案1:终于发现哪里出现了问题
new = ContactDetail(self, style=style, c
这一句应该是
new = ContactDetail(self.parent, style=style, c
好尴尬
以上介绍了“wxpython SplitterWindow panel 刷新后不能正确显示的问题?”的问题解答,希望对有需要的网友有所帮助。
本文网址链接:http://www.codes51.com/itwd/1531156.html