Move dictionary from instance to class level
Frank Millman
frank at chagford.com
Thu Aug 27 04:56:47 EDT 2009
Dave Angel wrote:
>
> Show me a sample client event handler, and maybe I can suggest how to
> encode it. For example in wxPython, events are encoded with
> an event
> object. You could have the event send the object's type-string as an
> event ID. No lookup at all. And in fact, one event handler
> then might
> handle several of the events for a given widget, or even for multiple
> ones. I guess it's not that simple, since you frequently
> have to pass
> other information, such as the state of the Ctrl-key, or the mouse
> position on the screen, which is not directly encoded in the
> event type.
That is definitely *not* what I want to do.
I want to make the server as generic as possible, so that it can handle any
type of client, hopefully even including a browser eventually. Therefore the
server has no knowledge of wxPython event types.
I have abstracted all the event types I am interested in (the list is fairly
stable now). My protocol requires that the client maps a specific gui event
type to a message identifier, and the server maps the message identifier to
a method that handles the message.
Hope that makes sense.
Frank
More information about the Python-list
mailing list