Path: ...!weretis.net!feeder8.news.weretis.net!fu-berlin.de!uni-berlin.de!not-for-mail From: Alan Gauld Newsgroups: comp.lang.python Subject: Re: IDLE: clearing the screen Date: Sun, 9 Jun 2024 19:06:07 +0100 Lines: 33 Message-ID: References: <66670225-276b-48cf-b271-6962daef903b@btinternet.com> <532f6235-300a-40a3-85ca-12e573243090@yahoo.co.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Trace: news.uni-berlin.de D+7/afQgOzH8OJ7ifrSL9QOiPDQ5JP7AOHI7/z8n1WWg== Cancel-Lock: sha1:x4Cj4NPg7Nl7BUp5azUVHNIb+fk= sha256:r0955qpQmTWoBPuOz63/L1Ej77PWA/XRfe7z3Gfz2aY= Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org Authentication-Results: mail.python.org; dkim=pass reason="2048-bit key; unprotected key" header.d=gmail.com header.i=@gmail.com header.b=G6odISIu; dkim-adsp=pass; dkim-atps=neutral X-Spam-Status: OK 0.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'def': 0.04; 'apparently': 0.09; 'blank': 0.09; 'idle': 0.09; 'ok,': 0.09; 'prints': 0.09; 'subject:IDLE': 0.09; 'terminal': 0.09; 'import': 0.15; 'flickr': 0.16; 'from:name:alan gauld': 0.16; 'message-id:@yahoo.co.uk': 0.16; 'photo-blog': 0.16; 'received:mail-lj1-x233.google.com': 0.16; 'subject:screen': 0.16; 'url-ip:79.170.44.132/32': 0.16; 'url-ip:79.170.44/24': 0.16; 'url-ip:79.170/16': 0.16; 'url- ip:79/8': 0.16; 'url:alan-g': 0.16; 'url:alan_gauld': 0.16; 'url:alangauldphotos': 0.16; 'wrote:': 0.16; 'instead': 0.17; 'url:amazon': 0.19; 'to:addr:python-list': 0.20; 'advanced': 0.22; 'mac': 0.22; 'skip:_ 10': 0.22; 'code': 0.23; 'to:name:python- list@python.org': 0.24; '(and': 0.25; 'solution.': 0.26; 'header :User-Agent:1': 0.30; 'program': 0.31; 'think': 0.32; 'course.': 0.32; 'python-list': 0.32; 'received:192.168.1': 0.32; 'but': 0.32; "didn't": 0.34; 'printing': 0.34; 'header:In-Reply-To:1': 0.34; 'received:google.com': 0.34; 'from:addr:gmail.com': 0.35; "it's": 0.37; 'author': 0.37; 'class': 0.37; 'received:192.168': 0.37; 'single': 0.39; 'use': 0.39; 'alan': 0.40; 'learn': 0.40; 'best': 0.61; 'skip:o 10': 0.61; 'here': 0.62; 'follow': 0.62; 'clear': 0.64; 'url:author': 0.69; 'site': 0.70; 'low': 0.74; 'quick': 0.77; 'rob': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717956369; x=1718561169; darn=python.org; h=content-transfer-encoding:in-reply-to:references:to :content-language:subject:user-agent:mime-version:date:message-id :from:from:to:cc:subject:date:message-id:reply-to; bh=Qc+NRcfRBk2MFkT85VnEYxAMH3f+O3uiPjp5zfW1THI=; b=G6odISIuLpPWKGDNXXElOAuxw43RPZ39vFcCzfM4o6JUU0PXkEn/ww6w+7vqOejLwr unaEga2VkDl6/N+aEoro1XwCKcvYdCEb6qubIOrmuaLE5K14C6YWhYvSy9aKOmjycq8m WIQJZGI5Xwu+G4K16ECEBNeEpdscF7AfEq3ydv2jcqnshuuAy9hC969eTYIKSk1sxAY0 oKwDMOWDvJSq+a3h2M5nt3MQ/mUvdRiuiQ+hKpOYl1T5rHarJhEWvK9xJalkISVhgyP9 umElCPcP9FxKUuvT7C6kuPyDr9pSFGHDUbj5uKKwMB1C/QzZj7YKGRJXOP5seQaqJO7S iIpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717956369; x=1718561169; h=content-transfer-encoding:in-reply-to:references:to :content-language:subject:user-agent:mime-version:date:message-id :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Qc+NRcfRBk2MFkT85VnEYxAMH3f+O3uiPjp5zfW1THI=; b=ik0VMPZ87pFAmqSj/4CVAPEitZIHRs6bU7Kb8n/IovEZ6UE/5Z6CsJqJeTMsTZ6Eqw 0YRlwZBzVBu7CVEWGiezZeLCkpyLeVy1HG6uENDZjWx/y8KZrFyXnCul1AMtBeVicrLh uaHURv2wE4igGh8gLxPv6xETWN7gPM1r2bQuXHdEs2qEbEh3EFlhmY6Ox9Qt6VlSyYQJ VcUdKRQWwgpm3xfp3CDtwHegatGkE0BLiBd8ioBMB/Bqbv2jqEuucdTpPpJPiH/ojWVd MbRvK7yqWXhN5cHB5X09neYKXZS/qbu/9xzWovfu9qHT5Np0xTYY63gZmsFx5UxKwF5n D3EQ== X-Forwarded-Encrypted: i=1; AJvYcCUVdMzIkwG22U3T8FaEVJk7+3QOI/BWCqNe5/IXkrHwrx7O9V6Gwc2LoU2zzbvLlA3mCv+QnryJQmptDgNu5R9ssYgaljbB X-Gm-Message-State: AOJu0YzEhoQGWDVCjrCLfJ6pK/uQMnvsSV6menF2cO0aOrgGzyges0Vn 6Pn7z89FsexyhuVqH6tfDjxbIFNdgirJt5XYDmdhgkffH6MRFFwVBWYmyw== X-Google-Smtp-Source: AGHT+IHDQ4B/bdQvt+I9ba0wJxJjFpJbbmpgHQCL2RwOSNO3PVZzG/yON238wdcSzI1PhWvciQ8C3A== X-Received: by 2002:a2e:2c11:0:b0:2ea:e26d:c9bc with SMTP id 38308e7fff4ca-2eae26dca84mr40191391fa.40.1717956368849; Sun, 09 Jun 2024 11:06:08 -0700 (PDT) X-Google-Original-From: Alan Gauld User-Agent: Mozilla Thunderbird Content-Language: en-GB In-Reply-To: <66670225-276b-48cf-b271-6962daef903b@btinternet.com> X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.39 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: <532f6235-300a-40a3-85ca-12e573243090@yahoo.co.uk> X-Mailman-Original-References: <66670225-276b-48cf-b271-6962daef903b@btinternet.com> Bytes: 6442 On 08/06/2024 20:18, Rob Cliffe via Python-list wrote: > OK, here is the advanced version: > import os > class _cls(object): >     def __repr__(self): >         os.system('cls') >         return '' > cls = _cls() > > Now when you type > cls > it clears the screen.  For me on a Mac it clears the terminal screen that I used to launch IDLE and prints a single blank line on the IDLE shell. (And I have to use "clear" instead of "cls" of course. A quick Google suggests that printing Ctrl-L (formfeed?) might be a platform agnostic solution. But that didn't work for me in IDLE either. I think this is one where the best bet is to go into the IDLE code and add a Shell submenu to clear screen! Apparently it's been on the workstack at idle-dev for a long time but is considered low priority... -- 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