Hello,
I am trying to learn how to us pyOpenGL with wxpython. By the way, hats off to the wxPython team it is a really great GUI dev platform. Been using it for probably 8 years. I really like it and feel it is been very reliable and a fantastic experience! I mainly wanted to say that because this is my first post.
Anyways, I have a binding problem and I’m unsure why. I’m using Python 2.7 and am trying to run the attached example. Ex2.py (3.4 KB)
I’m trying to use the wx.EvtHandler.Bind
call instead of wx.EVT_PAINT because the latter is deprecated. I’m confused because the error I get shown below:
TypeError: unbound method _EvtHandler_Bind() must be called with EvtHandler instance as first argument (got PyEventBinder instance instead)
implies that the first argument shouldn’t be the wx.EVT_PAINT but when I ctrl click on the .Bind function it shows the following method prameters:
Bind an event to an event handler.
:param event: One of the ``EVT_*`` event binder objects that
specifies the type of event to bind.
:param handler: A callable object to be invoked when the
event is delivered to self. Pass ``None`` to
disconnect an event handler.
:param source: Sometimes the event originates from a
different window than self, but you still
want to catch it in self. (For example, a
button event delivered to a frame.) By
passing the source of the event, the event
handling system is able to differentiate
between the same event type from different
controls.
:param id: Used to spcify the event source by ID instead
of instance.
:param id2: Used when it is desirable to bind a handler
to a range of IDs, such as with EVT_MENU_RANGE.
When I’ve used this bind before I’ve done the following: (just an example)
self.Bind(wx.EVT_MENU, self.onGainSetBase10, id=211)
So in this example, I’m unsure how to rebind these events to handlers to prevent the deprecation issue from the original bindings.
self.Bind(wx.EVT_MENU, self.onGainSetBase10, id=211)