Thanks for putting time to fix the code, but unfortunately it didn't make
any difference in the accessibility of the program. Not sure why.
On Sat, Oct 5, 2019 at 9:23 PM Jordy Deweer <jordyydeweer@xxxxxxxxx> wrote:
Hi. You may check the following code and tell if that works? It is
possible that it doesn’t fix your issue…
import wx
class Frame(wx.Frame):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
pnl = wx.Panel(self)
box = wx.BoxSizer(wx.HORIZONTAL)
innerBox1 = wx.BoxSizer(wx.VERTICAL)
stUserName = wx.StaticText(pnl, label="User name")
innerBox1.Add(stUserName)
tcUserName = wx.TextCtrl(pnl)
innerBox1.Add(tcUserName)
box.Add(innerBox1)
innerBox2 = wx.BoxSizer(wx.VERTICAL)
stPassword = wx.StaticText(pnl, label="Password")
innerBox2.Add(stPassword)
tcPassword = wx.TextCtrl(pnl)
innerBox2.Add(tcPassword)
box.Add(innerBox2)
pnl.SetSizer(box)
The rest of the code is unchanged. What I did is:
- I moved all the statements of one control so that they are created
and added together (makes it possible to use one variable to create and add
several elements à memory optimized)
- Then I moved all sizers togeter, so that first the left sizer is
created and then added and after that the right boxsizer. Same principle as
the previous bullet, but then for the entire sizer added to the main sizer.
- I left the panel setsizer under all sizer statements, so that the
all-in sizer will be added to the panel.
Hope this helps!
Sent from Mail <https://go.microsoft.com/fwlink/?LinkId=550986> for
Windows 10
*From: *Meisam Amini <meisamamini21@xxxxxxxxx>
*Sent: *Saturday, October 5, 2019 7:17 PM
*To: *program-l@xxxxxxxxxxxxx
*Subject: *[program-l] Re: Question about accessibility in wxPython
Quentin, thanks for the help, but the order thing doesn't work for me. I
have Windows 10 and the small test script I wrote doesn't work accessibly
neither with NVDA nor with JAWS. I paste the code I wrote here and also
attach it to this email. Maybe I have done something wrong.
import wx
class Frame(wx.Frame):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
pnl = wx.Panel(self)
box = wx.BoxSizer(wx.HORIZONTAL)
innerBox1 = wx.BoxSizer(wx.VERTICAL)
stUserName = wx.StaticText(pnl, label="User name")
tcUserName = wx.TextCtrl(pnl)
innerBox1.Add(stUserName)
innerBox1.Add(tcUserName)
innerBox2 = wx.BoxSizer(wx.VERTICAL)
stPassword = wx.StaticText(pnl, label="Password")
tcPassword = wx.TextCtrl(pnl)
innerBox2.Add(stPassword)
innerBox2.Add(tcPassword)
box.Add(innerBox1)
box.Add(innerBox2)
pnl.SetSizer(box)
def main():
a=wx.App()
f=Frame(None, title="Sample", name="Sample")
f.Show()
a.MainLoop()
if __name__ == "__main__":
main()
On Sat, Oct 5, 2019 at 6:36 PM Jordy Deweer <jordyydeweer@xxxxxxxxx>
wrote:
Hey Quentin
If you can provide a small working example (I lack the time to do it
quickly myself), I would be happy to test it out on a MacBook.
Greetings, Jordy
Sent from Mail <https://go.microsoft.com/fwlink/?LinkId=550986> for
Windows 10
*From: *QuentinC <quentinc@xxxxxxxxxxx>
*Sent: *Saturday, October 5, 2019 3:44 PM
*To: *program-l@xxxxxxxxxxxxx
*Subject: *[program-l] Re: Question about accessibility in wxPython
Hello,
Something that works well on windows (and anyway you don't have anything
else) is to make sure to create your controls in the right order.
First the static text label, then immediately after, the associated
control. No other control in between.
Only the order of creation is important. Their place on screen or sizer
settings have no importance.
You may customize accessibility stuff by using wxAccessible, but it's
quite complicated if you want to do it well. So better stay out of it.
Just create your controls in the right order and you have nothing else
to do.
Always creating controls in a well defined order also implicitely
establish the tab traversal in that same order.
IN a wxDialog, you then have nothing else special to do to have tab
working fine. IN wxFrame it works better if all controls are put in a
wxPanel rather than directly in the wxFrame.
So for example, if you have a login dialog box, you should create the
controls in that order:
1. wxStaticText "Username:"
2. wxTextCtrl for the username field
3. wxStaticText "Password:"
4. wxTextCtrl for the password
5. wxCheckboxCtrl for remember me
6. wxButton for OK
7. wxButton for Cancel
Note that checkboxes, radios and buttons don't need a static text label,
because they contin themselves and alone the text read by Jaws/NVDA.
Sadly, I don't knwo at all if it's so easy in other platforms. No one
has been able to reply for mac so far, in particular.
Hopes that helps
** To leave the list, click on the immediately-following link:-
** [mailto:program-l-request@xxxxxxxxxxxxx?subject=unsubscribe]
** If this link doesn't work then send a message to:
** program-l-request@xxxxxxxxxxxxx
** and in the Subject line type
** unsubscribe
** For other list commands such as vacation mode, click on the
** immediately-following link:-
** [mailto:program-l-request@xxxxxxxxxxxxx?subject=faq]
** or send a message, to
** program-l-request@xxxxxxxxxxxxx with the Subject:- faq