This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2019年12月27日 18:15 by twister68@gmail.com, last changed 2022年04月11日 14:59 by admin. This issue is now closed.
| Messages (3) | |||
|---|---|---|---|
| msg358908 - (view) | Author: David Turner (twister68@gmail.com) | Date: 2019年12月27日 18:15 | |
Trying to set up shortcut function to clear screen but its not working as expected on my Mac OS Catalina -- below is txt from idle
import os
>>> cls= lambda: os.system('clear')
>>> cls()
256
|
|||
| msg359022 - (view) | Author: Ned Deily (ned.deily) * (Python committer) | Date: 2019年12月30日 07:14 | |
Unfortunately, this is not going to work as you expect because you are mixing commands for different windowing systems. The OS-level 'clear' command is used to clear a normal terminal window by issuing special character sequences to standard output that are recognized by the terminal emulator, like for instance Terminal.app on macOS. When you run commands using os.system() under IDLE on macOS, the standard output descriptor for the subprocess created by os.system is not handled by IDLE. Currently open Issue11820 describes this problem. You are apparently running IDLE.app (by launching the app from the Finder) and the command fails because standard output of the subprocess is not associated with a terminal window. If, instead, you launched IDLE from a terminal window (in Terminal.app): /usr/local/bin/idle3.8 and ran your test, you would see that the 'clear' clears the Terminal.app window, not the IDLE shell window (and now returns a status of 0), still not what you are looking for. Even if Issue11820 is implemented such that the standard output from subprocesses are associated with the IDLE shell window, there would still be a problem in that the special character sequences sent by the 'clear' command would most likely not be recognized by the IDLE shell window or its underlying Tk widget, so using the OS 'clear' command still would not work. A better solution is for IDLE to provide its own 'clear' command and that is the subject of open Issue6143, which this issue should probably be closed as a duplicate of. |
|||
| msg359261 - (view) | Author: Terry J. Reedy (terry.reedy) * (Python committer) | Date: 2020年01月03日 22:16 | |
Among other problems, the patch for #11820 uses a unix-only tcl function. In non-shell editor and output windows, Select all (Control-A at least on windows) Delete (or Backspace, or Cut to clipboard, ^X on Windows) clears the window. Delete does not work for the read-only history portion of the Shell, hence the request for a separate menu item. However, if an editor window is open, one can still get a clean Shell by closing Shell and re-opening with Run => Shell or running the file being edited. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:59:24 | admin | set | github: 83322 |
| 2020年01月03日 22:16:03 | terry.reedy | set | status: open -> closed title: IDLE Clear function returns 256 on Mac OS Catalina -> IDLE: system clear function returns 256 on Mac OS Catalina superseder: IDLE - clear and restart the shell window messages: + msg359261 resolution: duplicate stage: resolved |
| 2019年12月30日 07:20:26 | ned.deily | set | assignee: terry.reedy components: + IDLE |
| 2019年12月30日 07:14:48 | ned.deily | set | nosy:
+ ned.deily messages: + msg359022 |
| 2019年12月27日 19:47:57 | xtreak | set | nosy:
+ terry.reedy |
| 2019年12月27日 18:15:59 | twister68@gmail.com | create | |