[Tutor] Interactive editing of variables.

Alan Gauld alan.gauld at yahoo.co.uk
Sat Jun 1 14:58:13 EDT 2019


On 01/06/2019 08:55, mhysnm1964 at gmail.com wrote:

> As I am using Python 3.7 under windows. I have tried to use the win32gui,
> and Tkinter. Both generate the below errors and I cannot identify a module
> release to support the version of Python I am using.

Tkinter should be included in the standard Windows download
you should not need to install it.

try

>>> import tkinter   # not Tkinter!

If there are no errors it is available

> I gave up on the cursers due to the above issues and looking at example
> code. It was far to complex to achieve the simple thing I wanted too do.

Here is some basic Tkinter code that does what I think you want.
You have to close the window by clicking the close icon but
that could be incorporated in the button code.


import tkinter as tk

myVar = ""

def get_value(edt):
    global myVar
    myVar = edt.get()

def edit_val(val):
    top = tk.Tk()
    ed = tk.Entry(top)
    ed.insert(tk.END, val)
    ed.pack()
    tk.Button(top,text="Store changes",
              command=lambda : get_value(ed)).pack()
    top.mainloop()

myVar = input("Enter a start value: ")
print( "Before: ", myVar)
edit_val(myVar)
print( "After: ", myVar)

> The issue I have with a lot of GUI programs built for Python they generally
> fail in the accessibility department for a screen reader. 

I can't help there I have nearly zero experience of using accessibility
tools. But I'd expect any GUI toolkit to work with the standard
OS tools. After all they are ultimately all built using the
underlying primitive GUI API

> Most open source software which is multi-platform supported fail in this 

Of course, since most open source authors have no incentive to
develop accessible specific code. They are just scratching
their own itch and making it available to anyone who wants
to use it. That's how open source works.

> .... This is a major issue for software developers
> not considering all users and there is legal requirements here. Sorry, I am
> falling on to my band wagon of in-accessible or non-inclusive design
> products which is my passion.

I can understand why folks get excited about it,
especially if they (or friends/family) need that feature.
But the cost (both in time and money) of doing so
is considerable and if nobody is paying (or there
is a time deadline) then it tends not to get done.
That's capitalism in action.


-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos




More information about the Tutor mailing list