[program-l] Re: Command line interface editing using python.

  • From: Dzhovani <dzhovani.chemishanov@xxxxxxxxx>
  • To: program-l@xxxxxxxxxxxxx
  • Date: Sat, 1 Jun 2019 11:38:23 +0300

Hi,

  You can emulate key presses to fill in the text to be edited on the console. After the program is done typing it, you can apply your edits and send them with enter. However, unless it is some kind of exercise, most likely you can just use a command line editor like vim.


On 1.6.2019 г. 10:58, mhysnm1964@xxxxxxxxx wrote:


Nick,

I am going down the path of GuI. I only need a simple box popping up with the value already populated. Cursors I cannot install under windows and I have just found out it is not reliable. I am having issues with installing win32gui module. Saying the version is not supported. Someone has recommended another module which I will check out.

I really need to look at the book which was posted a couple of days ago for GUI programming. But I don’t have bookshare access at this point of time. I might need to check other sources.

*From:*program-l-bounce@xxxxxxxxxxxxx <program-l-bounce@xxxxxxxxxxxxx> *On Behalf Of *ntsiklauri2@xxxxxxxxx
*Sent:* Saturday, 1 June 2019 4:45 PM
*To:* program-l@xxxxxxxxxxxxx
*Subject:* [program-l] Re: Command line interface editing using python.

If you want to show text of test after the value of modify you can concatenate it. that would work as long as it is a string. if you are dealing with numbers, you can pass it to str function and concatenate it that way. see the code below.

x=input(“modify: ”+a)


for detecting keypresses in console, i don't exactly remember the function that lets you do that right now. i'll have to look through my projects and get back to you.

Hth.

Nick.

Sent from my iPhone


On Jun 1, 2019, at 07:22, <mhysnm1964@xxxxxxxxx <mailto:mhysnm1964@xxxxxxxxx>> <mhysnm1964@xxxxxxxxx <mailto:mhysnm1964@xxxxxxxxx>> wrote:

    All,

    I have a list (array) with pre-populated. I want to modify some of
    the elements via console using python. I have found the input()
    command  for python 3.7. But function does not allow me to insert
    a variable to be edited.

    For example:

    A = ‘test of text’

    B = Input (‘Modify:’)

    The above function does not allow you to show the following and
    modify:

    Modify: test of text

    Then I want to use the backspace, arrow keys, etc to change the
    “test of text” to something else and on pressing enter the new
    value is saved in a variable. This I want to do in the console.
    Not GUI.

Other related posts: