[wxPython-users] Many Similar Dialogs For Date Entry

Rich Shepard rshepard at appl-ecosys.com
Fri Feb 2 12:59:12 PST 2007


On Fri, 2 Feb 2007, Paul Koning wrote:

> If your inputs are strings of the right form (or can be turned into such
> strings), you can use them to construct function (or method) names
> directly:
>
> 	  def process(cmd):
> 	      action = globals().get("process_cmd_%s" % cmd)
> 	      if not action:
> 		 print "Invalid command"
> 		 return
> 	      action ()

Paul,

   Yes, they are strings; choices from a wx.RadioBox(). This would save one
step since a dictionary would end up calling a function in any case. No?

Thanks,

Rich

-- 
Richard B. Shepard, Ph.D.               |    The Environmental Permitting
Applied Ecosystem Services, Inc.        |          Accelerator(TM)
<http://www.appl-ecosys.com>     Voice: 503-667-4517      Fax: 503-667-8863




More information about the wxpython-users mailing list