@@ -818,6 +818,92 @@ def tk_inactive(self, reset=False, *, displayof=0):
818818 else :
819819 return self .tk .getint (self .tk .call (args ))
820820
821+ # Accessibility support for assistive technologies such as screen
822+ # readers. Requires Tk 9.1 or newer. If no assistive technology
823+ # is active when the application starts, all these calls (except
824+ # tk_check_screenreader()) have no effect and return 0.
825+
826+ def tk_check_screenreader (self ):
827+ """Return whether a screen reader is currently running.
828+
829+ Requires Tk 9.1 or newer."""
830+ return self .tk .getboolean (self .tk .call (
831+ 'tk' , 'accessible' , 'check_screenreader' ))
832+
833+ def tk_set_acc_role (self , value ):
834+ """Set the accessible role of the widget."""
835+ self .tk .call ('tk' , 'accessible' , 'set_acc_role' , self ._w , value )
836+
837+ def tk_get_acc_role (self ):
838+ """Return the accessible role of the widget."""
839+ return self .tk .call ('tk' , 'accessible' , 'get_acc_role' , self ._w )
840+
841+ def tk_set_acc_name (self , value ):
842+ """Set the accessible name of the widget."""
843+ self .tk .call ('tk' , 'accessible' , 'set_acc_name' , self ._w , value )
844+
845+ def tk_get_acc_name (self ):
846+ """Return the accessible name of the widget."""
847+ return self .tk .call ('tk' , 'accessible' , 'get_acc_name' , self ._w )
848+
849+ def tk_set_acc_description (self , value ):
850+ """Set the accessible description of the widget."""
851+ self .tk .call ('tk' , 'accessible' , 'set_acc_description' ,
852+ self ._w , value )
853+
854+ def tk_get_acc_description (self ):
855+ """Return the accessible description of the widget."""
856+ return self .tk .call ('tk' , 'accessible' , 'get_acc_description' ,
857+ self ._w )
858+
859+ def tk_set_acc_value (self , value ):
860+ """Set the accessible value of the widget."""
861+ self .tk .call ('tk' , 'accessible' , 'set_acc_value' , self ._w , value )
862+
863+ def tk_get_acc_value (self ):
864+ """Return the accessible value of the widget."""
865+ return self .tk .call ('tk' , 'accessible' , 'get_acc_value' , self ._w )
866+
867+ def tk_set_acc_state (self , value ):
868+ """Set the accessible state of the widget."""
869+ self .tk .call ('tk' , 'accessible' , 'set_acc_state' , self ._w , value )
870+
871+ def tk_get_acc_state (self ):
872+ """Return the accessible state of the widget."""
873+ return self .tk .call ('tk' , 'accessible' , 'get_acc_state' , self ._w )
874+
875+ def tk_set_acc_action (self , value ):
876+ """Set the accessible action of the widget."""
877+ self .tk .call ('tk' , 'accessible' , 'set_acc_action' , self ._w , value )
878+
879+ def tk_get_acc_action (self ):
880+ """Return the accessible action of the widget."""
881+ return self .tk .call ('tk' , 'accessible' , 'get_acc_action' , self ._w )
882+
883+ def tk_set_acc_help (self , value ):
884+ """Set the accessible help text of the widget."""
885+ self .tk .call ('tk' , 'accessible' , 'set_acc_help' , self ._w , value )
886+
887+ def tk_get_acc_help (self ):
888+ """Return the accessible help text of the widget."""
889+ return self .tk .call ('tk' , 'accessible' , 'get_acc_help' , self ._w )
890+
891+ def tk_add_acc_object (self ):
892+ """Register the widget with the platform accessibility API."""
893+ self .tk .call ('tk' , 'accessible' , 'add_acc_object' , self ._w )
894+
895+ def tk_emit_selection_change (self ):
896+ """Notify the platform accessibility API that the selection
897+ in the widget has changed."""
898+ self .tk .call ('tk' , 'accessible' , 'emit_selection_change' , self ._w )
899+
900+ def tk_emit_focus_change (self ):
901+ """Notify the platform accessibility API that the widget has
902+ received focus.
903+
904+ Not available on macOS."""
905+ self .tk .call ('tk' , 'accessible' , 'emit_focus_change' , self ._w )
906+
821907 def wait_variable (self , name ):
822908 """Wait until the variable is modified.
823909
0 commit comments