In wxPython 4.0 Phoenix, I'm trying to use wx.html2.WebView with a screen reader.
Whether with JAWS or NVDA, I have to make a left mouse click on the Widget to be able to see my page in an accessible Web interface.
Here is my code, but know that I'm having the same problem with the LoadURL method.
Should I add something so that the focus is directly in the web interface as soon as the Widget is displayed?
Thank you in advance for your answers.
import wx
import wx.html2
class MyWebView (wx.Dialog):
def __init__(self, parent):
wx.Dialog.__init__(self, parent)
sizer = wx.BoxSizer(wx.VERTICAL)
self.browser = wx.html2.WebView.New(self)
self.changeBtn = wx.Button (self, -1, label="Change page")
# The pages that I want to display disposed in a tuple.
self.pages = (
"<html><head><title>Hello everyone !</title></head><body><h1>We're testing wx.html2.WebView with a Screen Reader !</h1></body></html>",
"<html><head><title>Second page !</title></head><body><h1>This is a second page</h1></body></html>",
"<html><head><title>Third page !</title></head><body><h1>This is a third page</h1></body></html>"
)
self.index = 0
self.display = self.pages[self.index]
sizer.Add(self.browser, 1, wx.EXPAND, 10)
sizer.Add(self.changeBtn)
self.SetSizer(sizer)
self.SetSize((700, 700))
# Events.
self.changeBtn.Bind (wx.EVT_BUTTON, self.onChangePage)
def onChangePage (self, evt):
self.index += 1
if self.index == len (self.pages):
self.index = 0
self.display = self.pages[self.index]
self.browser.SetPage(self.display, "")
if __name__ == '__main__':
app = wx.App()
dialog = MyWebView (None)
dialog.browser.SetPage(dialog.display, "")
dialog.Show ()
app.MainLoop()
Kind regards.