centering HtmlHelpWindow on parent window

I have an app that display HTML help in the following manner:

<SNIP>
            temp_controller = HtmlHelpController(parentWindow=self)
            if not temp_controller.AddBook(helppath):
                return

            self.help = temp_controller

        self.help.DisplayContents()
        self.help.FindTopLevelWindow().Centre(wx.BOTH)
</SNIP>

Our problem is that the call to Centre() results in a poor user
experience in that the user will see a brief display of the window up
in the top left of the screen followed by the help window being
displayed in the center of the app's main window.

Is there a better means of centering an HTML help window on the parent
window?

Chris

ckamps wrote:

<SNIP>
        self.help.DisplayContents()
        self.help.FindTopLevelWindow().Centre(wx.BOTH)
</SNIP>

Did you try switching the order of those two statements?

-Chris

Our problem is that the call to Centre() results in a poor user
experience in that the user will see a brief display of the window up
in the top left of the screen followed by the help window being
displayed in the center of the app's main window.

Is there a better means of centering an HTML help window on the parent
window?

there is wx.Window.CentreOnParent(), I think.

same thing, but a bit cleaner, if the TLW is the parent, anyway.

-Chris

···

--
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@noaa.gov

Yes, I had tried that, but doing so results in:

line 1651, in OnHelp
    self.help.FindTopLevelWindow().Centre(wx.BOTH)
AttributeError: 'NoneType' object has no attribute 'Centre'

Presumably because the frame or window is not available prior to
calling DisplayContents().

Thanks,
Chris

···

On Jan 21, 11:27 am, Christopher Barker <Chris.Bar...@noaa.gov> wrote:

ckamps wrote:
> <SNIP>
> self.help.DisplayContents()
> self.help.FindTopLevelWindow().Centre(wx.BOTH)
> </SNIP>

Did you try switching the order of those two statements?

ckamps wrote:

ckamps wrote:

<SNIP>
        self.help.DisplayContents()
        self.help.FindTopLevelWindow().Centre(wx.BOTH)
</SNIP>

Did you try switching the order of those two statements?

Yes, I had tried that, but doing so results in:

line 1651, in OnHelp
    self.help.FindTopLevelWindow().Centre(wx.BOTH)
AttributeError: 'NoneType' object has no attribute 'Centre'

Presumably because the frame or window is not available prior to
calling DisplayContents().

I'm a bit confused about how these windows relate:

http://wiki.wxpython.org/MakingSampleApps

what about:

self.Centre(wx.BOTH)

or self.

help.Centre(wx.BOTH)

though I don't know what "self" is

-Chris

···

On Jan 21, 11:27 am, Christopher Barker <Chris.Bar...@noaa.gov> wrote:

--
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@noaa.gov

That is correct. The frame used by the help controller is not created until one of the Display methods has been called for the first time. It doesn't look like there is any way to set the size/pos of that frame before it is created.

···

On 1/21/10 2:19 PM, ckamps wrote:

On Jan 21, 11:27 am, Christopher Barker<Chris.Bar...@noaa.gov> wrote:

ckamps wrote:

<SNIP>
         self.help.DisplayContents()
         self.help.FindTopLevelWindow().Centre(wx.BOTH)
</SNIP>

Did you try switching the order of those two statements?

Yes, I had tried that, but doing so results in:

line 1651, in OnHelp
     self.help.FindTopLevelWindow().Centre(wx.BOTH)
AttributeError: 'NoneType' object has no attribute 'Centre'

Presumably because the frame or window is not available prior to
calling DisplayContents().

--
Robin Dunn
Software Craftsman