[Pygui] Native wrappers?

Vernon Cole vernondcole at gmail.com
Mon Dec 21 02:45:32 CET 2009


Greg and everyone:

These days I am trying to make all of my programs super-portable --
CPython2.x, IronPython and Python3 on Windows and Linux.  2/3 of these use
ONLY unicode strings.  One of my reasons for migrating to PyGUI is because
there are no plans for wxPython to run on any platform other than 2.x.  I am
guessing that PyGUI, being more simple, is going to be much easier to
convert to the other compilers than its competition.

  What I am getting at is this advice from a very old programmer... try to
make everything work correctly with unicode. It will make life much easier
when conversion time comes around.  When you do need byte strings, use a
user-written function to produce them, not a built in.  This is one that I
have found useful:
v v v v
def str2bytes(sval):
    if sys.version_info < (3,0) and isinstance(sval, str):
        sval = sval.decode("latin1")
    return sval.encode("latin1")
^ ^ ^ ^
 --
Vernon Cole


On Sat, Dec 19, 2009 at 8:04 PM, Greg Ewing <greg.ewing at canterbury.ac.nz>wrote:

> Dan Villiom Podlaski Christiansen wrote:
>
>  I'm seeing a weird issue; for some  reason ‘Open as…’ and ‘Save as…’
>>
> > create a menu item per character in their name.
>
> Sounds like it thinks they're menu item groups instead of
> single items.
>
> Are these perhaps unicode strings? In Generic/GMenus.py,
> Menu._make_item(), there's the following piece of code:
>
>  if isinstance(text, str):
>    return SingleMenuItem(text, cmd, substitutions)
>  else:
>    return MenuItemGroup(text, cmd)
>
> This could get confused if it's given a unicode string
> instead of a plain str. It should probably be amended to
> take unicode into account.
>
> --
> Greg
> _______________________________________________
> Pygui mailing list
> Pygui at python.org
> http://mail.python.org/mailman/listinfo/pygui
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pygui/attachments/20091220/320533b4/attachment.htm>


More information about the Pygui mailing list