This is my try for creating custom widget. I am trying to create a custom slider. It’s working fine but I am not able to set wx.CommandEvent for
various stats(LEFT_UP, LEFT_DOWN, MOTION etc.)
I have used wx.PyPanel for making the slider. Is it OK? or what ever I have done, I mean look wise can be done If I subclass wx.Slider for making
a custom slider
This is my try for creating custom widget. I am trying to create a custom slider. It’s working fine but I am not able to set wx.CommandEvent for
various stats(LEFT_UP, LEFT_DOWN, MOTION etc.)
When constructing an event object you need to pass an event type (i.e wx.wxEVT_, not wx.EVT_),
See line 80 in your sample.
You are rebinding EVT_LEFT_UP in your Frame and not skipping the event so it doesn’t propagate down to your other handler inside your slider class.
I think you want to check for HasCapture instead of GetCapture.
I have used wx.PyPanel for making the slider. Is it OK? or what ever I have done, I mean look wise can be done If I subclass wx.Slider for making
a custom slider
When constructing an event object you need to pass an event type (i.e
wx.wxEVT_, not wx.EVT_),
See line 80 in your sample.
Cody,
Does every Event (e.g., wx.EVT_*) have an EventType analog (e.g.,
wx.wxEVT_*) If so, where do I find them?
I’m trying to create a Notebook event for a unittest, but
wx.wxEVT_NOTEBOOK_PAGE_CHANGED doesn’t appeart to exist.
If they are a command event (notebook commands are) they typically are as follows
wx.wxEVT_COMMAND_*
Most/all events should have an associated event type though they are not always named in a predictable manner. I am sure they are in the documentation somewhere. But I typically just do something like the following in a python shell to find what I am looking for,
for x in dir(wx):
if ‘NOTEBOOK_PAGE_CHANGED’ in x:
print x
You should see a wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED in there
On Wed, Aug 6, 2008 at 12:32 PM, Cody Precord <codyprecord@gmail.com> wrote:
Hello,
On 8/6/08, Timothy Grant <timothy.grant@gmail.com> wrote:
On Wed, Aug 6, 2008 at 11:29 AM, Cody Precord <codyprecord@gmail.com> >> wrote:
>
> 1) When constructing an event object you need to pass an event type (i.e
> wx.wxEVT_*, not wx.EVT_*),
> See line 80 in your sample.
Cody,
Does every Event (e.g., wx.EVT_*) have an EventType analog (e.g.,
wx.wxEVT_*) If so, where do I find them?
I'm trying to create a Notebook event for a unittest, but
wx.wxEVT_NOTEBOOK_PAGE_CHANGED doesn't appeart to exist.
If they are a command event (notebook commands are) they typically are as
follows
wx.wxEVT_COMMAND_*
Most/all events should have an associated event type though they are not
always named in a predictable manner. I am sure they are in the
documentation somewhere. But I typically just do something like the
following in a python shell to find what I am looking for,
for x in dir(wx):
if 'NOTEBOOK_PAGE_CHANGED' in x:
print x
You should see a wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED in there
>
> 1) When constructing an event object you need to pass an event
type (i.e
> wx.wxEVT_*, not wx.EVT_*),
> See line 80 in your sample.
Cody,
Does every Event (e.g., wx.EVT_*) have an EventType analog (e.g.,
wx.wxEVT_*) If so, where do I find them?
I'm trying to create a Notebook event for a unittest, but
wx.wxEVT_NOTEBOOK_PAGE_CHANGED doesn't appeart to exist.
If they are a command event (notebook commands are) they typically are as follows
wx.wxEVT_COMMAND_*
Most/all events should have an associated event type though they are not always named in a predictable manner. I am sure they are in the documentation somewhere. But I typically just do something like the following in a python shell to find what I am looking for,
for x in dir(wx):
if 'NOTEBOOK_PAGE_CHANGED' in x:
print x
You should see a wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED in there
If you don't care what the actual name of the eventType is then there is a shortcut to get the value using the binder object. They have a typeId property that returns the value. As you can see here it is the same as the wxEVT_* version:
Some events are composites of other events, (EVT_MOUSE_EVENTS and EVT_SCROLL for example) so there is also another attribute that is a list of eventType ID values: