How to understand event binder?

Hi,

Below code are copied from wxPython demo.

   (UpdateBarEvent, EVT_UPDATE_BARGRAPH) = wx.lib.newevent.NewEvent()

Here I know EVT_UPDATE_BARGRAPH is a event binder object.

then, the EVT_UPDATE_BARGRAPH passed to the first argument of Bind() method of a event handler,

   self.Bind(EVT_UPDATE_BARGRAPH, self.OnUpdate)

But, according to the documentation, the Bind() method should accept a eventtype argument, not an event binder. My question is that can I event binder automatically cast to an eventtype? How did this happen?

Thanks in advance.

···

-
narke

Which Bind() documentation are you looking at? (Hint: try running "pydoc wx.EvtHandler.Bind") The C++ implementation of Bind() is different than wxPython's implementation, although they did get the basic idea from us. wxPython has had Bind() for many years, the C++ Bind is relatively new and was added in the 2.9 series.

···

On 6/5/12 9:55 PM, narke wrote:

Hi,

Below code are copied from wxPython demo.

(UpdateBarEvent, EVT_UPDATE_BARGRAPH) = wx.lib.newevent.NewEvent()

Here I know EVT_UPDATE_BARGRAPH is a event binder object.

then, the EVT_UPDATE_BARGRAPH passed to the first argument of Bind()
method of a event handler,

self.Bind(EVT_UPDATE_BARGRAPH, self.OnUpdate)

But, according to the documentation, the Bind() method should accept a
eventtype argument, not an event binder. My question is that can I event
binder automatically cast to an eventtype? How did this happen?

--
Robin Dunn
Software Craftsman

Yes, I was refering the C++ doc. How you run pydoc? In my Windows installation, I can only find a pydocgui.pyw scrip under the installation directory of Tools/Scripts. When I started script, I get a search window, but it found nothing if after I typed in 'wx.EvtHandler.Bind'.

···

On 6/6/2012 2:57 PM, Robin Dunn wrote:

On 6/5/12 9:55 PM, narke wrote:

Hi,

Below code are copied from wxPython demo.

(UpdateBarEvent, EVT_UPDATE_BARGRAPH) = wx.lib.newevent.NewEvent()

Here I know EVT_UPDATE_BARGRAPH is a event binder object.

then, the EVT_UPDATE_BARGRAPH passed to the first argument of Bind()
method of a event handler,

self.Bind(EVT_UPDATE_BARGRAPH, self.OnUpdate)

But, according to the documentation, the Bind() method should accept a
eventtype argument, not an event binder. My question is that can I event
binder automatically cast to an eventtype? How did this happen?

Which Bind() documentation are you looking at? (Hint: try running "pydoc
wx.EvtHandler.Bind") The C++ implementation of Bind() is different than
wxPython's implementation, although they did get the basic idea from us.
wxPython has had Bind() for many years, the C++ Bind is relatively new
and was added in the 2.9 series.

Hi,

Below code are copied from wxPython demo.

(UpdateBarEvent, EVT_UPDATE_BARGRAPH) = wx.lib.newevent.NewEvent()

Here I know EVT_UPDATE_BARGRAPH is a event binder object.

then, the EVT_UPDATE_BARGRAPH passed to the first argument of Bind()
method of a event handler,

self.Bind(EVT_UPDATE_BARGRAPH, self.OnUpdate)

But, according to the documentation, the Bind() method should accept a
eventtype argument, not an event binder. My question is that can I event
binder automatically cast to an eventtype? How did this happen?

Which Bind() documentation are you looking at? (Hint: try running "pydoc
wx.EvtHandler.Bind") The C++ implementation of Bind() is different than
wxPython's implementation, although they did get the basic idea from us.
wxPython has had Bind() for many years, the C++ Bind is relatively new
and was added in the 2.9 series.

Yes, I was refering the C++ doc. How you run pydoc? In my Windows
installation, I can only find a pydocgui.pyw scrip under the
installation directory of Tools/Scripts. When I started script, I get a
search window, but it found nothing if after I typed in
'wx.EvtHandler.Bind'.

Since pydoc is also a module in the standard library you can run it like this:

     python -m pydoc wx.EvtHandler.Bind

Or in the Python interactive environment you can do:

     >>> import wx
     >>> help(wx.EvtHandler.Bind)

Or this:

     >>> import wx
     >>> print wx.EvtHandler.Bind.__doc__

Or you can look at one of the old Python-specific set of docs, like these:

     wxPython API Documentation — wxPython Phoenix 4.2.2 documentation
http://xoomer.virgilio.it/infinity77/wxPython/Widgets/wx.EvtHandler.html#Bind

Or the new documentation being made for Project Phoenix:

     http://wxpython.org/Phoenix/docs/html/EvtHandler.html#EvtHandler.Bind

···

On 6/6/12 1:12 AM, narke wrote:

On 6/6/2012 2:57 PM, Robin Dunn wrote:

On 6/5/12 9:55 PM, narke wrote:

--
Robin Dunn
Software Craftsman

Thanks for telling me that. And, help(wx.EvtHandler.Bind) is clear document!

···

On 6/7/2012 12:07 AM, Robin Dunn wrote:

On 6/6/12 1:12 AM, narke wrote:

On 6/6/2012 2:57 PM, Robin Dunn wrote:

On 6/5/12 9:55 PM, narke wrote:

Hi,

Below code are copied from wxPython demo.

(UpdateBarEvent, EVT_UPDATE_BARGRAPH) = wx.lib.newevent.NewEvent()

Here I know EVT_UPDATE_BARGRAPH is a event binder object.

then, the EVT_UPDATE_BARGRAPH passed to the first argument of Bind()
method of a event handler,

self.Bind(EVT_UPDATE_BARGRAPH, self.OnUpdate)

But, according to the documentation, the Bind() method should accept a
eventtype argument, not an event binder. My question is that can I
event
binder automatically cast to an eventtype? How did this happen?

Which Bind() documentation are you looking at? (Hint: try running "pydoc
wx.EvtHandler.Bind") The C++ implementation of Bind() is different than
wxPython's implementation, although they did get the basic idea from us.
wxPython has had Bind() for many years, the C++ Bind is relatively new
and was added in the 2.9 series.

Yes, I was refering the C++ doc. How you run pydoc? In my Windows
installation, I can only find a pydocgui.pyw scrip under the
installation directory of Tools/Scripts. When I started script, I get a
search window, but it found nothing if after I typed in
'wx.EvtHandler.Bind'.

Since pydoc is also a module in the standard library you can run it like
this:

python -m pydoc wx.EvtHandler.Bind

Or in the Python interactive environment you can do:

>>> import wx
>>> help(wx.EvtHandler.Bind)

Or this:

>>> import wx
>>> print wx.EvtHandler.Bind.__doc__

Or you can look at one of the old Python-specific set of docs, like these:

wxPython API Documentation — wxPython Phoenix 4.2.2 documentation

http://xoomer.virgilio.it/infinity77/wxPython/Widgets/wx.EvtHandler.html#Bind

Or the new documentation being made for Project Phoenix:

http://wxpython.org/Phoenix/docs/html/EvtHandler.html#EvtHandler.Bind

--
narke
I can't go back to yesterday - because I was a different person then.