Python论坛  - 讨论区

标题:[python-chinese] BUG? 在wxPython中wx.TreeCtrl的SelectItem()会产生两次EVT_TREE_SEL_CHANGING和EVT_TREE_SEL_CHANGED事件

2005年04月09日 星期六 07:29

Jason Liu telecomliu at gmail.com
Sat Apr 9 07:29:31 HKT 2005

class Main_Window(wx.Dialog):
    def __init__(self, parent, id, title):
        wx.Dialog.__init__(self, parent, -1,
style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER)
        self.init_ctrl()

    def init_ctrl(self):
parent=self, pos=wx.Point(88, 32),size=wx.Size(440, 22))
        self.Button = wx.Button(parent=self, id=wx.ID_OK, name="Ok",
pos = wx.Point(2, 250))
        self.Button.Bind(wx.EVT_BUTTON, self.OnClick)
        self.Tree = wx.TreeCtrl(id=103, parent = self, size=wx.Size(150, 200))
        self.Tree.Bind(wx.EVT_TREE_SEL_CHANGING, self.TreeSelChanging)
        self.Tree.Bind(wx.EVT_TREE_SEL_CHANGED, self.TreeSelChanged)
        ItemId = self.Tree.AddRoot('Root')
        self.Item1 = self.Tree.AppendItem(ItemId, 'Item 1')
    def TreeSelChanging(self, event):
        print 1
    def TreeSelChanged(self, event):
        print 2
    def OnClick(self, event):
        self.Tree.SelectItem(self.Item1)

class MyApp(wx.App):
    def OnInit(self):
        frame = Main_Window(None, -1, 'Noname')
        self.SetTopWindow(frame)
        frame.ShowModal()
        frame.Destroy()
        return True

app = MyApp(0)
app.MainLoop()

结果是
1
1
2
2

TreeSelChanging()和TreeSelChanged()被调用了两次。BUG吗?

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2005年04月09日 星期六 13:47

Qiangning Hong hongqn at gmail.com
Sat Apr 9 13:47:22 HKT 2005

On Apr 9, 2005 7:29 AM, Jason Liu <telecomliu at gmail.com> wrote:
[snip]

> def init_ctrl(self):
> parent=self, pos=wx.Point(88, 32),size=wx.Size(440, 22))
> 
[snip]

你贴出来的程序有错,没法运行。

File "test.py", line 10
parent=self, pos=wx.Point(88, 32),size=wx.Size(440, 22))
^
IndentationError: expected an indented block

-- 
Qiangning Hong
Get Firefox! <
http://www.spreadfirefox.com/?q=affiliates&id=67907&t=1>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20050409/70882559/attachment.html

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2005年04月09日 星期六 13:52

Qiangning Hong hongqn at gmail.com
Sat Apr 9 13:52:26 HKT 2005

拜托你把自动回复关了成不成?!

On Apr 9, 2005 1:47 PM, 60_days at 163.com <60_days at 163.com> wrote:
> 
> 您发给我的信件已经收到。
> 
> --------------------------------------------
> 网易@163.com免费电子邮箱,260兆超大空间,支持12兆附件,全国唯一24小时客户服务。
> 欢迎您来注册使用。网易邮件中心:http://mail.163.com




-- 
Qiangning Hong
Get Firefox! <
http://www.spreadfirefox.com/?q=affiliates&id=67907&t=1>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20050409/a21646ae/attachment-0001.html

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2005年04月09日 星期六 13:57

Xin LI delphij at frontfree.net
Sat Apr 9 13:57:46 HKT 2005

我的建议是大家把“网易邮箱自动回复”作为关键词过滤掉,或者一起抵制网易邮
箱――给他们的postmaster写信没人理我……


  _____  

From: python-chinese-bounces at lists.python.cn
[mailto:python-chinese-bounces at lists.python.cn] On Behalf Of Qiangning Hong
Sent: Saturday, April 09, 2005 1:52 PM
To: Qiangning Hong; python-chinese at lists.python.cn
Subject: Re: 网易邮箱自动回复: Re: [python-chinese] BUG? 在 wxPython中
wx.TreeCtr l的Select Item()会产生两次EVT_TREE_SEL_CHAN GIN G和
EVT_TREE_SEL_CHANGED事件


拜托你把自动回复关了成不成?!


On Apr 9, 2005 1:47 PM, 60_days at 163.com <60_days at 163.com> wrote: 

您发给我的信件已经收到。

--------------------------------------------
网易@163.com免费电子邮箱,260兆超大空间,支持12兆附件,全国唯一24小时客户服
务。
欢迎您来注册使用。网易邮件中心:http://mail.163.com




-- 
Qiangning Hong
Get Firefox! <http://www.spreadfirefox.com/?q=affiliates
<http://www.spreadfirefox.com/?q=affiliates&id=67907&t=1>
&id=67907&t=1>


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20050409/701b0397/attachment.htm

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

如下红色区域有误,请重新填写。

    你的回复:

    请 登录 后回复。还没有在Zeuux哲思注册吗?现在 注册 !

    Zeuux © 2025

    京ICP备05028076号