Your architecture with the panels is a bit unusual.
You hear ‘panel’ as the panel has the focus.
Static texts will be read when you move the mouse over them or when they seem to be associated to another control.
E.g. if you create a static text followed by a text ctrl or button, the static text will be spoken when the other controls gains the keyboard focus.
A static text itself will not gain the keyboard focus, so you will never hear it when just using the keyboard.
I have create an example with a static text, a text ctrl and a button on the same panel.
The static text and the text ctrl have the same text, with “(static text)” and “(text ctrl)” added, respectively. So you will hear your text twice.
Here’s the code:
import wx
class MyFrame(wx.Frame):
def __init__(self, *args, **kwds):
kwds["style"] = kwds.get("style", 0) | wx.DEFAULT_FRAME_STYLE
wx.Frame.__init__(self, *args, **kwds)
self.SetSize((400, 300))
self.SetTitle("frame")
self.panel_1 = wx.Panel(self, wx.ID_ANY)
sizer_1 = wx.BoxSizer(wx.VERTICAL)
label_1 = wx.StaticText(self.panel_1, wx.ID_ANY, "Welcome to TQ Reminders (static text)")
sizer_1.Add(label_1, 0, wx.ALL, 4)
self.text_ctrl_1 = wx.TextCtrl(self.panel_1, wx.ID_ANY, "Welcome to TQ Reminders (text ctrl)", style=wx.TE_READONLY)
sizer_1.Add(self.text_ctrl_1, 0, wx.ALL | wx.EXPAND, 4)
self.button_1 = wx.Button(self.panel_1, wx.ID_ANY, "hey girl")
sizer_1.Add(self.button_1, 0, wx.ALL, 4)
self.panel_1.SetSizer(sizer_1)
self.Layout()
class MyApp(wx.App):
def OnInit(self):
self.frame = MyFrame(None, wx.ID_ANY, "")
self.SetTopWindow(self.frame)
self.frame.Show()
return True
app = MyApp(0)
app.MainLoop()
You may want to try wxGlade. It’s quite accessible and it has some visually impaired users. Whenever there are accessibility issues, I try to address them. When you start with wxGlade, have a look at Preferences->Accessibility. There you can enable some options for better screen reader access.
I have attached a zip archive with the wxGlade file and the generated Python code.
What wxPython version are you using? There are some version that don’t work well with screen readers. E.g. 4.0.3 is working while 4.0.4 to 4.0.7 are causing problems. 4.1 should be fine, though.
accessibility.zip (1.5 KB)