screen clear question

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • jcollins

    #1

    screen clear question

    Is there a command in Python to clear the screen? That is without writing
    multiple blank lines.

    Thanks.

    Jim C


  • Craig Ringer

    #2
    Re: screen clear question

    On Sun, 2005-01-02 at 11:31, jcollins wrote:[color=blue]
    > Is there a command in Python to clear the screen? That is without writing
    > multiple blank lines.[/color]

    Without knowing what 'screen' you're talking about, it's hard to say. If
    you mean clearing a terminal, you can call 'tput clear' or
    '/usr/bin/clear' on many UNIX systems; no idea about Windows.

    --
    Craig Ringer

    Comment

    • Daniel Bickett

      #3
      Re: screen clear question

      import os

      # windows
      os.system("cls" )

      # bash ( mac, linux )
      os.system("clea r")

      That's all I can account for.

      Daniel Bickett

      Comment

      • Alan Gauld

        #4
        Re: screen clear question

        On Sun, 02 Jan 2005 14:23:07 +0800, Craig Ringer
        <craig@postnews papers.com.au> wrote:[color=blue]
        > On Sun, 2005-01-02 at 11:31, jcollins wrote:[color=green]
        > > Is there a command in Python to clear the screen? That is without writing
        > > multiple blank lines.[/color]
        >
        > Without knowing what 'screen' you're talking about, it's hard to say. If
        > you mean clearing a terminal, you can call 'tput clear' or
        > '/usr/bin/clear' on many UNIX systems; no idea about Windows.[/color]

        On Windows the DOS CLS command will clear a command prompt, it
        also works for CP/M and VAX terminals too. Finally I think the
        curses module allows you to clear a window, including the main
        window - ie the terminal screen.

        In each case run CLS (or clear) via os.system()

        But the bottom line is that there is no builtin command
        because the mechanism is different on each platform.

        Alan G.
        Author of the Learn to Program website

        Comment

        • Nick Coghlan

          #5
          Re: screen clear question

          Alan Gauld wrote:[color=blue]
          > But the bottom line is that there is no builtin command
          > because the mechanism is different on each platform.[/color]

          I'd have said it was because the inpreter is line-oriented rather than
          screen-oriented, but YMMV.

          Cheers,
          Nick.

          --
          Nick Coghlan | ncoghlan@email. com | Brisbane, Australia
          ---------------------------------------------------------------

          Comment

          • Alan Gauld

            #6
            Re: screen clear question

            On Mon, 03 Jan 2005 02:15:23 +1000, Nick Coghlan[color=blue]
            > Alan Gauld wrote:[color=green]
            > > But the bottom line is that there is no builtin command
            > > because the mechanism is different on each platform.[/color]
            >
            > I'd have said it was because the inpreter is line-oriented rather than
            > screen-oriented, but YMMV.[/color]

            Yeah, that might be a reason as well :-)

            But then the early PC GW-Basic or BASICA interpreters were line
            based too but both provided a CLS command because the *programs*
            that were written were usually screen based... But they ran on a
            single OS so a CLS was easily possible.

            Alan G.


            Author of the Learn to Program website

            Comment

            • Andrew Robert

              #7
              Re: screen clear question

              Nick Coghlan wrote:[color=blue]
              > Alan Gauld wrote:
              >[color=green]
              >> But the bottom line is that there is no builtin command because the
              >> mechanism is different on each platform.[/color]
              >
              >
              > I'd have said it was because the inpreter is line-oriented rather than
              > screen-oriented, but YMMV.
              >
              > Cheers,
              > Nick.
              >[/color]
              I would try doing a test against the resident OS the program is running
              against and set the clear command based on that.


              --
              Thank you,
              Andrew Robert

              E-mail: arobert@townisp .com
              Ur: http://shardservant.no-ip.info

              Comment

              Working...