[wxPython-users] Re: changes in keycodes between 2.6 and 2.8

Josiah Carlson jcarlson at uci.edu
Fri Dec 29 19:54:44 PST 2006


jmf <jfauth at bluewin.ch> wrote:
> Werner wrote:
> 
> Why not store the string values in your preference files?
> 
> Then do something along these lines:
>   >>> import wx
>   >>> wx.WXK_CONTROL
> 308
>   >>> x = 'WXK_CONTROL'
>   >>> getattr(wx, x)
> 308
>   >>>
> 
> ----
> 
> or
> 
>  >>> import wx
>  >>> s = 'wx.WXK_CONTROL'
>  >>> eval(s)
> 308
>  >>>

Using eval() where getattr() would work is generally seen to be poor
form.  FYI.

 - Josiah





More information about the wxpython-users mailing list