Re: Tools to help with text mode (i.e. non-GUI) input

Liste des GroupesRevenir à cl python 
Sujet : Re: Tools to help with text mode (i.e. non-GUI) input
De : ram (at) *nospam* zedat.fu-berlin.de (Stefan Ram)
Groupes : comp.lang.python
Date : 14. Jan 2025, 12:22:15
Autres entêtes
Organisation : Stefan Ram
Message-ID : <Cmd-20250114122123@ram.dialup.fu-berlin.de>
References : 1 2 3 4 5 6
Chris Green <cl@isbd.net> wrote or quoted:
Yes, thanks all, maybe just straightforward curses is the way to go.
Looking at some of the 'cleverer' ones they end up looking remarkably
like GUI code, in which case I might as well use a GUI. I have written
a (fairly simple) Gtk based python program, I was just trying to avoid
all the GUI overheads for a little new project.

  The Cmd class is your go-to for whipping up those bare-bones
  command line interfaces. It's hella useful for cobbling
  together test rigs, admin tools, and rough drafts that'll
  eventually get a facelift with some fancy UI.

  Check out this sample of what Cmd code might look like:

class TurtleShell( cmd.Cmd ):
    intro = 'Welcome to the turtle shell. Type help or ?.\n'
    prompt = '(turtle) '
    file = None
   
    def do_forward(self, arg):
        'Move the turtle forward by the specified distance: FORWARD 10'
        forward(*parse(arg))
        . . .
    . . .
. . .

  And here's a taste of what a Cmd UI could shape up to be:

Welcome to the turtle shell. Type help or ? to list commands.

(turtle) ?

Documented commands (type help <topic>):
========================================
bye color goto home playback record right
circle forward heading left position reset undo

(turtle) help forward
Move the turtle forward by the specified distance: FORWARD 10
(turtle) record spiral.cmd
(turtle) position
Current position is 0 0
. . .



Date Sujet#  Auteur
14 Jan 25 * Re: Tools to help with text mode (i.e. non-GUI) input5Alan Gauld
14 Jan 25 `* Re: Tools to help with text mode (i.e. non-GUI) input4Chris Green
14 Jan 25  +- Re: Tools to help with text mode (i.e. non-GUI) input1Stefan Ram
15 Jan 25  +- Re: Tools to help with text mode (i.e. non-GUI) input1Grant Edwards
16 Jan 25  `- Re: Tools to help with text mode (i.e. non-GUI) input1Alan Gauld

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal