简体   繁体   English

如何确保 Python qt 应用程序在所有操作系统上都是屏幕可读的

[英]how can ensure that a Python qt application is screen readable on all operating systems

I am developing a text with Python and Qt that can be used by blind and visually impaired people.我正在开发一个带有 Python 和 ZE8801102A40AD89DDCFDCAEBF008D25Z 的文本,可供盲人和视障人士使用。 The text editor should be suitable for screen readers.文本编辑器应该适合屏幕阅读器。 I do tests with the screen readers NVDA (Windows) and Orca (Ubuntu).我使用屏幕阅读器 NVDA (Windows) 和 Orca (Ubuntu) 进行测试。

Texts for screen readers should actually be saved in the "AccessibleDescription" property.屏幕阅读器的文本实际上应该保存在“AccessibleDescription”属性中。 The NVDA screen reader does not read the "AccessibleDescription" property. NVDA 屏幕阅读器不会读取“AccessibleDescription”属性。 AccessibleName property only.仅限 AccessibleName 属性。 The Orca screen reader reads the "AccessibleDescription" property. Orca 屏幕阅读器读取“AccessibleDescription”属性。

Question: What can I do so that my application is screen-readable on all operating systems?问题:我可以怎样做才能使我的应用程序在所有操作系统上都是屏幕可读的?

Short answer简短的回答

Sadly, there's probably no magic solution here.可悲的是,这里可能没有神奇的解决方案。 The only reasonnable answer is just trying and testing a maximum of different combinations of OS, screen readers, GUI toolkits and components, as much as you can.唯一合理的答案就是尽可能多地尝试和测试操作系统、屏幕阅读器、GUI 工具包和组件的不同组合。 That's the only way to discover what works well for your particular scope, and what doesn't.这是发现什么对您的特定 scope 有效,什么无效的唯一方法。 There is no uniformity at all between OS, screen readers and GUI toolkits, and probably no combination working everywhere in all cases.操作系统、屏幕阅读器和 GUI 工具包之间根本没有统一性,而且可能没有任何组合在所有情况下都适用。

Longer answer更长的答案

This isn't a peasure to give this answer but in fact, if you want to make sure your app is 100% screen reader accessible, your only way is basicly to stop using GUI toolkits and exclusively use the native components offered by the OS for which accessibility is well documented;给出这个答案并不是一件容易的事,但事实上,如果您想确保您的应用程序可以 100% 访问屏幕阅读器,您唯一的方法基本上是停止使用 GUI 工具包并专门使用操作系统提供的本机组件哪些可访问性有据可查; and therefore of course develop as many different apps as OS you intent to support.因此,当然可以开发与您打算支持的操作系统一样多的不同应用程序。 As soon as you are using a GUI toolkit, you are adding a layer, and may lose some accessibility (and often more than less) in the process.一旦您使用 GUI 工具包,您就添加了一个层,并且在此过程中可能会失去一些可访问性(而且通常多于少)。

The gap between the features offered by the native OS components and those proposed in the toolkit is often closed by emulation, and some of the emulations aren't made accessible, or simply can't be made accessible for various (more or less excusable) reasons.本机操作系统组件提供的功能与工具包中提出的功能之间的差距通常通过仿真来弥补,并且某些仿真无法访问,或者根本无法使各种(或多或少可以原谅)原因。 That's why some components are accessible while some others aren't;这就是为什么有些组件可以访问而有些则不能访问的原因。 why a given component can be accessible under one OS but not at all under another;为什么一个给定的组件可以在一个操作系统下访问,但在另一个操作系统下根本不能访问; and why a component can be accessible in version N of the toolkit but not the same component in version N+1.以及为什么一个组件可以在工具包的版本 N 中访问,但在版本 N+1 中不能访问相同的组件。 In short, you have understood, accessibility is extremely fragile.简而言之,您已经了解,可访问性是极其脆弱的。

Sadly, GUI toolkits rarely well document accessibility of their components under the different OS they support.遗憾的是,GUI 工具包很少能很好地记录其组件在它们支持的不同操作系统下的可访问性。 That's really a shame.这真是一种耻辱。 It has to be addressed.它必须得到解决。 Additionally, accessibility is often presented as being expert compicated features.此外,可访问性通常表现为专家级的复杂功能。 It shouldn't be so.不应该这样。 It should be easy for app developers to make accessible apps.应用程序开发人员应该很容易制作可访问的应用程序。

So, wwell, since there is often no documentation about accessibility, your only way is to try and test.所以,好吧,因为通常没有关于可访问性的文档,你唯一的方法就是尝试和测试。 That's a lot of work, and there is no alternative.工作量很大,而且别无选择。 Try and test.尝试和测试。 That's all.就这样。

Digging deeper深层发掘

There's generally two foundamental ways to design a GUI toolkit, and depending on which has been chosen, this has a dramatic impact on natural accessibility, and what kind of accessibility the toolkit can hope to achieve.通常有两种设计 GUI 工具包的基本方法,根据选择的方式,这会对自然可访问性以及工具包希望实现的可访问性产生巨大影响。

  • The first way is to start from a blank page as far as the OS permits, and from there, decide literally everything: what components to provide, and how they should look and behave.第一种方法是在操作系统允许的范围内从空白页开始,然后从那里决定一切:提供哪些组件,以及它们的外观和行为方式。 By doing so, you make sure that your app will look and behave exactly the same everywhere.通过这样做,您可以确保您的应用在任何地方的外观和行为都完全相同。 An user might be surprised or confused the first time because look and behavior is often not 100% conform to OS conventions or user preferences, but in the long run, he/she will always feel at home with your app regardless of the OS used.用户第一次可能会感到惊讶或困惑,因为外观和行为通常不是 100% 符合操作系统约定或用户偏好,但从长远来看,无论使用何种操作系统,他/她都会对您的应用感到宾至如归。 However, more importantly, create everything from a blank page also means that everything must be defined from scratch for accessibility.然而,更重要的是,从空白页面创建所有内容也意味着必须从头开始定义所有内容以实现可访问性。 It requires of course a lot of work, whether for the GUI implementers, or the app developer.当然,无论是 GUI 实现者还是应用程序开发者,都需要做大量工作。 Different toolkits place the responsibility cursor at different places.不同的工具包将责任 cursor 放在不同的地方。 Some toolkits perform better and/or go further than others, but in general they are nowhere near what the native components of the OS can provide.一些工具包比其他工具包性能更好和/或 go 比其他工具包更好,但总的来说,它们远不及操作系统的本机组件所能提供的。
  • The second way is to use as much as possible the components proposed by the OS, and emulate only missing features when they are really needed.第二种方法是尽可能多地使用操作系统提出的组件,并仅在真正需要时模拟缺少的功能。 This is excellent for accessibility, since almost all native OS components are naturally accessible or only require little effort.这对于可访问性非常有用,因为几乎所有本机操作系统组件都可以自然访问或只需要很少的努力。 Users will have an app that conforms to the general look of their OS, and so won't be confused or surprised by the interface and its behavior.用户将拥有一个符合其操作系统总体外观的应用程序,因此不会对界面及其行为感到困惑或惊讶。 However, the app isn't going to look exactly the same in all computers.但是,该应用程序在所有计算机上的外观并不完全相同。 Sadly, for many designers and developers, this is a definitive stopper.可悲的是,对于许多设计师和开发人员来说,这是一个明确的障碍。

As the vaste majority of GUI toolkits I know of, QT is part of the first group, but isn't playing that bad in accessibility (at least under windows) if the app developer is also aware of accessibility.作为我所知道的绝大多数 GUI 工具包,QT 是第一组的一部分,但如果应用程序开发人员也意识到可访问性,那么在可访问性方面(至少在 Windows 下)并没有那么糟糕。 In the second group, you have WXWidgets for example.在第二组中,例如,您有 WXWidgets。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在某些操作系统上禁用Python程序? - How can I disable use of Python programs on certain operating systems? Python和不同的操作系统 - Python and different Operating Systems 如何使用Python连续读取基于Linux的操作系统的CPU温度? - How can I get a continuous reading of CPU temperature for Linux based operating systems using Python? 不同操作系统上的Python程序 - Python programs on different Operating Systems 如何在Python中区分“Android”与其他“Linux”操作系统? - How to distinguish “Android” from other “Linux” operating systems in Python? 为所有操作系统构建通用路径 - Build universal path for all operating systems 用于查询多个操作系统版本的python脚本 - python script for enquiring the version of multiple operating systems Python 3导入操作系统之间的行为差​​异 - Python 3 import behaviour differences between operating systems 如何用python程序打包所有必需的库,以便它可以在所有系统中运行? - How to package all the required libraries with the python program so that it can run in all systems? 如何在多个操作系统中手动告诉Python在脚本本身中使用哪个版本? - How do you manually tell Python which version to use in the script itself, across multiple operating systems?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM