Looking for a good working example of a Help window

Looking for a good working example of a Help window that works... I
need to put the instructions in my app ... I would like to do a
wx.html.HtmlWindow type situation where you can click on the link and
it takes you to the information ... I can't find any wxpython info or
examples ... can someone point me in a direction and any advice would
be welcomed

That's what we did for the help information in Task Coach.

See the HTMLDialog class in

Cheers, Frank

···

2011/11/14 aikidoguy <clayrichmond1@gmail.com>:

Looking for a good working example of a Help window that works... I
need to put the instructions in my app ... I would like to do a
wx.html.HtmlWindow type situation where you can click on the link and
it takes you to the information ... I can't find any wxpython info or
examples ... can someone point me in a direction and any advice would
be welcomed

I’ve found something strange in the source code of Task Coach:

from taskcoachlib.i18n import _

Doesn’t it have to be

from taskcoachlib.i18n import *

???

Bo�tjan Mejak wrote:

I’ve found something strange in the source code of Task Coach:
from taskcoachlib.i18n import _

Doesn’t it have to be

from
taskcoachlib.i18n import *

???

It would be if they wanted to import everything.� In this case, all

they wanted to import was the _ function, which is (by convention)
the function used to translate strings into the current language.

I'm guessing you didn't realize that _ was a valid Python name...
···
-- Tim Roberts, Providenza & Boekelheide, Inc.

timr@probo.com

its actually kind of annoying that _ is the translation function by
convention and its also some weird context variable inside the python
shell by definition... especially when localizing a program that opens
a shell...

anyway sorry for OT

···

On Nov 15, 9:44 am, Tim Roberts <t...@probo.com> wrote:

Bo�tjan Mejak wrote:
> I've found something strange in the source code of Task Coach:
> fromtaskcoachlib.i18nimport_

> Doesn't it have to be
> from taskcoachlib.i18n import *

> ???

It would be if they wanted to import everything. In this case, all they
wanted to import was the _ function, which is (by convention) the
function used to translate strings into the current language.

I'm guessing you didn't realize that _ was a valid Python name...

--
Tim Roberts, t...@probo.com
Providenza & Boekelheide, Inc.

IIRC I got this from Robin a long time ago to work around this issue:

# Install a custom displayhook to keep Python from setting the global
# _ (underscore) to the value of the last evaluated expression. If
# we don't do this, our mapping of _ to gettext can get overwritten.
# This is useful/needed in interactive debugging with PyShell.

def _displayHook(obj):
     if obj is not None:
         print repr(obj)

The above is at the beginning of my "app" module and prevents errors e.g. with the WIT's pycrust.

Werner

···

On 11/15/2011 07:00 PM, joran wrote:

its actually kind of annoying that _ is the translation function by
convention and its also some weird context variable inside the python
shell by definition... especially when localizing a program that opens
a shell...

anyway sorry for OT

It amazes me that a function has a name _. Do you find anything in nature that is named _? What kind of a name for a function is that?

+inf

Andrea.

···

On 15 November 2011 23:31, Boštjan Mejak wrote:

It amazes me that a function has a name _. Do you find anything in nature
that is named _? What kind of a name for a function is that?

You missed a step, I think you also need to assign that function to sys.displayhook so it will be called instead of the default function.

sys.displayhook = _displayHook

···

On 11/15/11 10:32 AM, werner wrote:

On 11/15/2011 07:00 PM, joran wrote:

its actually kind of annoying that _ is the translation function by
convention and its also some weird context variable inside the python
shell by definition... especially when localizing a program that opens
a shell...

anyway sorry for OT

IIRC I got this from Robin a long time ago to work around this issue:

# Install a custom displayhook to keep Python from setting the global
# _ (underscore) to the value of the last evaluated expression. If
# we don't do this, our mapping of _ to gettext can get overwritten.
# This is useful/needed in interactive debugging with PyShell.

def _displayHook(obj):
    if obj is not None:
        print repr(obj)

--
Robin Dunn
Software Craftsman

One that is very quick to type, is not too noticeable and does not
conflict with any previously, at the time, used one. In python it was
used to denote the last result, whatever it happened to be, (remember
the days when you didn't have a mouse and easy cut and paste), while in
wx it was adopted to mark strings that were possible translation
targets, _("Hello World") is not too obtrusive.

Gadget/Steve

···

On 15/11/2011 9:31 PM, Boštjan Mejak wrote:

It amazes me that a function has a name _. Do you find anything in
nature that is named _? What kind of a name for a function is that? --
To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com
or visit http://groups.google.com/group/wxPython-users?hl=en

Oops, thanks for pointing this out, yes this is in my OnInit of the wx.App.

Werner

···

On 11/15/2011 10:44 PM, Robin Dunn wrote:

On 11/15/11 10:32 AM, werner wrote:

On 11/15/2011 07:00 PM, joran wrote:

its actually kind of annoying that _ is the translation function by
convention and its also some weird context variable inside the python
shell by definition... especially when localizing a program that opens
a shell...

anyway sorry for OT

IIRC I got this from Robin a long time ago to work around this issue:

# Install a custom displayhook to keep Python from setting the global
# _ (underscore) to the value of the last evaluated expression. If
# we don't do this, our mapping of _ to gettext can get overwritten.
# This is useful/needed in interactive debugging with PyShell.

def _displayHook(obj):
    if obj is not None:
        print repr(obj)

You missed a step, I think you also need to assign that function to sys.displayhook so it will be called instead of the default function.

sys.displayhook = _displayHook

Not just wx, it became a defacto standard for gettext and similar message catalog libraries. Most examples I've seen of using Python's implementation of gettext also use _() despite the potential issue with the interactive interpreter. (For example, see the sample code at: gettext — Multilingual internationalization services — Python 3.13.0 documentation)

···

On 11/15/11 9:59 PM, Gadget/Steve wrote:

On 15/11/2011 9:31 PM, Bo�tjan Mejak wrote:

It amazes me that a function has a name _. Do you find anything in
nature that is named _? What kind of a name for a function is that?

One that is very quick to type, is not too noticeable and does not
conflict with any previously, at the time, used one. In python it was
used to denote the last result, whatever it happened to be, (remember
the days when you didn't have a mouse and easy cut and paste), while in
wx it was adopted to mark strings that were possible translation
targets, _("Hello World") is not too obtrusive.

--
Robin Dunn
Software Craftsman