[Tutor] Interactive editing of variables.

Sean Murphy mhysnm1964 at gmail.com
Sat Jun 1 08:20:31 EDT 2019


Mike, thanks for this debug tool. I might have a look at it. No that’s not the goal I’m after. I want to have a basic l input line which is already populated with a value. The value is extracted from a list of strength. Each element in the list are unique. I want to modify the string and then re-insert it back into the same element as the new modified string   I’m currently look at read line or piegnurl  module this might do the trick. Using GUI is way over the top for the simple thing I’m trying to do   The model which Alan kindly suggested if not accessible with a screen reader. As I cannot see e.g. blind, this is a critical component of my programming.

Please excuse any errors because I’m using Siri to send this email.

My experience is the part 

> On 1 Jun 2019, at 10:05 pm, Mike Barnett <mike_barnett at hotmail.com> wrote:
> 
> TL;DR
> There's a run-time debugger out, "imwatchingyou" that is being developed daily, fast paced, that enables debugging without stopped your code or using an IDE.  
> 
> I'm unsure if I'm super late to the party of if I understand the "problem" / request properly. I apologize if I'm off-base.
> 
> Do you want to be able to examine and modify variables while your program is running, without breaking into it with a debugger?  Is that part of it?
> 
> If so, I've been working my ass off for a couple of weeks to do just that, develop a realtime "watcher" / debugger.
> 
> You'll find the project here:
> https://github.com/PySimpleGUI/imwatchingyou
> 
> At this time, you must pip install imwatchingyou.  If you're concerned because of the name "imwatchingyou", it's meant to be YOU are watching YOUR code.  If I wanted to watch your Python code, I would have named it "makefreemoneyminingbitcoininpython".
> 
> There is a nice screenshot, although things have been changing.  There are 2 primary windows.  The brown one in the upper right of the screen is a realtime update of all of your local variables.  Then there's the large debug window that allows you to do more including running the built-in REPL.
> 
> There is also a version being built into the PySimpleGUI library itself so you do not have to do any imports, etc.  All PySimpleGUI will have this watch/debug capability in it.
> 
> 
> 
> 
> @mike
> 
> -----Original Message-----
> From: mhysnm1964 at gmail.com <mhysnm1964 at gmail.com> 
> Sent: Saturday, June 1, 2019 4:53 AM
> To: 'Alan Gauld' <alan.gauld at yahoo.co.uk>; tutor at python.org
> Subject: Re: [Tutor] Interactive editing of variables.
> 
> As I thought. Easygui is not accessible at all with a screen reader due to the underlying graphic library. Win32 could work if I could load it. Since then I could use standard windows objects.
> 
> Note, I didn't see anything in the quick scan I did ion the API. 
> 
> 
> Very frustrating and disappointing. 
> -----Original Message-----
> From: Tutor <tutor-bounces+mhysnm1964=gmail.com at python.org> On Behalf Of Alan Gauld via Tutor
> Sent: Saturday, 1 June 2019 4:50 PM
> To: tutor at python.org
> Subject: Re: [Tutor] Interactive editing of variables.
> 
>> On 01/06/2019 03:53, mhysnm1964 at gmail.com wrote:
>> 
>> I have no clue on how to achieve what I want to do and the code I have 
>> creates an hash. As shown below:
> 
> Thats because what you want is not a standard feature of CLI apps.
> You will need to do one of the following(in order of easiness):
> 1) Use a GUI - it then becomes a trivial matter
> 2) Use a pseudo GUI like curses to provide cursor control
> 3) Find a module that already does what you need
>   (maybe readline can be made to work?)
> 4) Write a function yourself using screen primitives
>   that manage the cursor
> 
> 
>> for row in description:
>>    text = description_rejex(row)
>>    if text[0] not in narration: 
>>        Result = input(text[0])
>>        narration[result] = text
> 
> The standard tools allow you to input a new value and overwrite the existing one. But there is no simple way to interactively modify an existing value (and of course you would need to convert it to/from a string for that to be
> possible)
> 
>> I have had a look and cannot find an example where I can interactively 
>> edit a content of a variable at the command line. I do not want to use 
>> GUI at all.
> 
> A GUI makes this a trivial problem. Simply display an edit control and insert the current value as a string. Allow the user to modify it and when done read the new value back. If you don't want to use a GUI you need to provide GUI like controls yourself, either through an existing module or by writing one. Something like easygui would be eminently suitable. But even vanilla Tkinter is almost trivial.
> 
> The curses library will do it but that is not standard on Windows and I've heard varying reports of how well it works there.
> 
> The readline library allows basic editing of the commands line but I'm not sure how you would insert your variable into the command line initially...
> 
> For windows there are a couple of modules available that provide low level cursor control and character input/output, so you could use one of those to write such a function.
> 
> And if you search hard enough you should find that somebody, somewhere has already done the work for you. But I don't know where...
> 
> --
> 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
> 
> 
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor
> 
> 
> <SNAG-0390.jpg>


More information about the Tutor mailing list