简体   繁体   English

如何调整 Python IDLE Shell 设置,以便我键入的下一行代码始终垂直停留在 shell 的中心?

[英]How do I adjust Python IDLE Shell settings so that the next line of code I type stays vertically in the center of the shell at all times?

So there is probably a real basic solution for this but I obviously don't know what it is.所以可能有一个真正的基本解决方案,但我显然不知道它是什么。 When I'm writing code in IDLE window, eventually I get to the bottom of the window and then each new line of code I write is at the bottom of the window, which is annoying to read as I'm continually staring at the bottom of my screen as I write each new line of code.当我在 IDLE window 中编写代码时,最终我到达了 window 的底部,然后我编写的每一行新代码都位于 window 的底部,这读起来很烦人,因为我一直盯着底部看在我编写每一行新代码时,我的屏幕。 Is there a way to get the IDLE shell to jump back to the top of the window once I reach the bottom?一旦我到达底部,有没有办法让 IDLE shell 跳回到 window 的顶部?

Or another way to look at it would be to constantly have roughly 20 or so empty lines present after the new line of code I'm writing, so that my code never gets to the bottom of the window and thus each new line of code I write is always centered in the window.或者另一种看待它的方式是在我正在编写的新代码行之后不断出现大约 20 行左右的空行,这样我的代码就永远不会到达 window 的底部,因此我的每一行新代码write 始终以 window 为中心。

I know I could simply minimize the window itself and position it so that the bottom of the window is in the center of my screen (vertically) but that's not really a solution as then I'm dealing with this window sliver that I'll have to maximize every time I want to review my code in it's whole.我知道我可以简单地将 window 本身和 position 最小化,以便 window 的底部位于屏幕中央(垂直),但这并不是真正的解决方案,因为那时我正在处理我将拥有的 window 条子每次我想完整地审查我的代码时最大化。

Thanks!谢谢!

The behavior of IDLE's Shell intentionally mimic the behavior interactive Python in command-line console and terminal programs. IDLE 的行为 Shell 有意模仿命令行控制台和终端程序中的交互行为 Python。 The latter typically default to 24 lines because that is what physical glass terminals usually had.后者通常默认为 24 行,因为这是物理玻璃终端通常具有的。 On modern high-definition monitors, 'normal' size fonts allow more lines on a screen.在现代高清显示器上,“正常”尺寸 fonts 允许在屏幕上显示更多行。 If a 24-line window is put with its top at the top of the screen, the bottom line is at the middle of the screen.如果将 24 行 window 放在屏幕顶部,则底部行位于屏幕中间。

IDLE defaults to 4O so one can seen more text at one time. IDLE 默认为 4O,因此一次可以看到更多文本。 You could customize this to fewer lines, but this would reduce the side of editor windows also.您可以将其自定义为更少的行,但这也会减少编辑器 windows 的边。 You could instead resize just the Shell with your mouse, and then move it up to the top of the screen.您可以使用鼠标仅调整 Shell 的大小,然后将其移至屏幕顶部。 When you want to see more, you can use Zoom Height on the options menu.当您想查看更多内容时,可以使用选项菜单上的缩放高度。 If you do not like the default hot key you can change it.如果您不喜欢默认的热键,您可以更改它。

When Shell starts, there is a blank space beneath the input prompt. Shell启动时,输入提示下方有一个空格。 This space is not filled with blank lines.这个空间没有填充空行。 If it were, you could move he cursor down.如果是,您可以将他 cursor 向下移动。 Once the window is filled with lines of whatever length, the only way to restore the blank space is to delete all but the last N lines.一旦 window任意长度的行填充,恢复空白的唯一方法是删除除最后 N 行以外的所有行。 https://bugs.python.org/issue6143 is about clearing all or possibly just some of the shell output. https://bugs.python.org/issue6143是关于清除全部或可能只是部分 shell output。

PS.附言。 The Shell windows uses one tkinter Text widget for both read-only history and read-write code entry. Shell windows 使用一个 tkinter 文本小部件,用于只读历史记录和读写代码输入。 I have thought about using two text boxes instead.我考虑过使用两个文本框。 This might allow keeping entry permanently above the output instead of below, but it is not clear if you would like this any better.这可能允许将条目永久保留在 output 以上而不是以下,但不清楚您是否希望这样做更好。

If I were to do make this split, I might add a configurable minimum size for the entry box, so that entry would always start k lines above the bottom.如果我要进行这种拆分,我可能会为输入框添加一个可配置的最小尺寸,以便该输入始终从底部上方的 k 行开始。 But this is speculative and still in the design stage.但这是推测性的,仍处于设计阶段。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在 WINdows 10 中打开 Python IDLE (Shell WIndow)? - How do I open Python IDLE (Shell WIndow) in WIndows 10? Python IDLE 如何从编辑器到 shell - Python IDLE how do I get from editor to shell 如何在Linux中重新启动IDLE Python Shell? - How do I restart the IDLE Python Shell in Linux? 如何在 Python IDLE Shell 中获取终端高度(以行为单位)? - How do I get the terminal height (in lines) in Python IDLE Shell? 如何在 Sublime Text 中创建构建系统以在 IDLE shell 中运行我的 python 代码? - How can I create a build system in Sublime Text to run my python code in an IDLE shell? 清除Python IDLE shell中的行 - Clear line in the Python IDLE shell 如何在同一个 IDLE shell 中多次运行 python 脚本,而不关闭和重新打开 shell? - How can I run a python script more than once in the same IDLE shell, without the shell closing and reopening? 如何使打印语句保持在同一行,同时将我的输入输入到下一个 - How do I make it so that the print statement stays on the same line while having my input to next one down 如何在django shell中打印出我的设置内容? - How do I print out the contents of my settings in a django shell? 如何在命令行上调用python脚本,就像调用普通的shell命令(如cp)一样? - How do I call a python script on the command line like I would call a common shell command, such as cp?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM