keyboard movement in wx.html.htmlwindow

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

keyboard movement in wx.html.htmlwindow

Nathan Smith
Hi there,

So here's what I'm trying to do:

I'm trying to create a window that pops up, processes basic html, and
behaves like an HTML window.

Think wx.textctrl, but multiline and with HTML processing capabilities.

Now here's my problem.

I wrote what I thought was a working html window, and it might be I'm
not sure.

I tried to access it with my screen reader and... It reads nothing.

So then I had a look around the web and found the example program at the
end of this email.

When it loads, my screen reader reads out all the text at once, and then
refuses to allow me to view it otherwise.


For clarification: I am using arrow keys to move about the window, to
very little success.

Is this just an accessibility barrier? Or are the arrow keys being
blocked from moving around or...

Any help is appreciated.

Nathan


Example program:

import wx
import wx.html as html


class MainFrame(wx.Frame):
     """Create MainFrame class."""
     def __init__(self):
         """Initialise the class."""
         wx.Frame.__init__(self, None, -1, 'Demonstrate wxPython Html')
         self.panel = MainPanel(self)
         self.Centre()
         self.html_display.SetPage(self.raw_html())

     @staticmethod
     def raw_html():
         html = ('<p><font color="#4C4C4C", size=2>What do we want: '
                     '<font color="#FF0000">all</font>'
                 '</p><h1>Hi</h1>This is a test')
         return html


class MainPanel(wx.Panel):
     """Create a panel class to contain screen widgets."""
     def __init__(self, frame):
         """Initialise the class."""
         wx.Panel.__init__(self, frame)
         html_sizer = self._create_html_control(frame)
         main_sizer = wx.BoxSizer(wx.HORIZONTAL)
         main_sizer.Add(html_sizer, flag=wx.ALL, border=10)
         self.SetSizerAndFit(main_sizer)

     def _create_html_control(self, frame):
         txt_style = wx.VSCROLL|wx.HSCROLL|wx.BORDER_SIMPLE|wx.WANTS_CHARS
         frame.html_display = html.HtmlWindow(self, -1,
                                                 size=(400, 200),
name="This sucks.",
                                                 style=txt_style)
         sizer = wx.BoxSizer(wx.HORIZONTAL)
         sizer.Add(frame.html_display)
         return sizer


if __name__ == '__main__':
     """Run the application."""
     screen_app = wx.App()
     main_frame = MainFrame()
     main_frame.Show(True)
     screen_app.MainLoop()

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/wxpython-users/75ba1e48-40e3-2eea-ffc4-59d08d1092a8%40gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: keyboard movement in wx.html.htmlwindow

Tim Roberts
Nathan smith wrote:
>
>
> So here's what I'm trying to do:
> I'm trying to create a window that pops up, processes basic html, and
> behaves like an HTML window.
> Think wx.textctrl, but multiline and with HTML processing capabilities.

Are you thinking of a wx.stc.StyledTextCtrl?


> Now here's my problem.
> I wrote what I thought was a working html window, and it might be I'm
> not sure.
> I tried to access it with my screen reader and... It reads nothing.

On what did you base your code?  Was it a plain TextCtrl?  I admit that
I know little about screen readers, but in order to be read, there has
to be a way for the reader to fetch the contents of your control from code.


> So then I had a look around the web and found the example program at
> the end of this email.
> When it loads, my screen reader reads out all the text at once, and
> then refuses to allow me to view it otherwise.
> For clarification: I am using arrow keys to move about the window, to
> very little success.

Right.  HTML windows are read-only.  They are, essentially, web
browsers.  They don't accept keyboard focus, so you can't navigate with
arrow keys.

And by the way, that sample code shows terrible programming style.  The
frame and the panel are tightly integrated, so that each one pokes
around in the other's insides.  Don't use this as an example of good
Python coding...

--
Tim Roberts, [hidden email]
Providenza & Boekelheide, Inc.


--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/wxpython-users/658d4c28-f6cd-7f95-6fe1-abba37bec4d8%40probo.com.
For more options, visit https://groups.google.com/d/optout.

smime.p7s (5K) Download Attachment