[Tutor] Help with the technique "Menu Processing"
by other posts by this author
Apr 29 2001 2:30AM messages near this date
[Tutor] popen
|
RE: [Tutor] Help with the technique "Menu Processing"
Hi Everyone,
I was wondering if I might be able to get some help with "Menu Processing".
What I'm looking for is an example of how it might be done within an object.
I've been trying myself, but I keep getting an error.
Here's an example of what I'm trying to do:
Class msg:
def __init__(self):
self.msgtype = {"priv":send_priv_msg,
"pub":send_pub_msg,
"action":send_action_msg,
"notice":send_notice_msg,
"ctcp":send_ctcp_msg}
...more stuff...
def send_priv_msg(connection, nick, text):
... send code ..
def send_pub_msg(connection, nick, text):
... send code ..
def send_action_msg(connection, nick, text):
... send code ..
def send_notice_msg(connection, nick, text):
... send code ..
def send_ctcp_msg(connection, nick, text):
... send code ..
def send_msg_by(connection, nick, text, type):
self.msgtype[type](connection, nick, text)
Thanks,
Juno
_______________________________________________
Tutor maillist - Tutor@[...].org
http://mail.python.org/mailman/listinfo/tutor
Thread:
Andrew Wilkins
|