python 3空闲进度条/加载条 [英] python 3 IDLE progressbar/loadingbar

查看:67
本文介绍了python 3空闲进度条/加载条的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是python3自带的标准IDE.

I am using the standard IDE that comes with python3.

我想在 ILE 中使用退格功能 (\b) 来创建一个好看的进度条.即使是简单的百分比计数器也需要退格功能.

I would like to make use of the backspace function (\b) within the ILE in order to create a NICE LOOKING progressbar. Even a simple percentage counter requires the backspace function.

当我运行脚本时,我得到一个非常无用的符号而不是退格.

When I run the script I get a wonderfully useless symbol instead of a backspace.

问题:

  1. 如何在 IDE 中使用 \b

  1. How can I use \b in the IDE

我还能如何制作一个使用类似于退格键的进度条(换句话说,我不想要一个蹩脚的,例如:loading:##########################

How else can I make a progress bar that would use something similar to a backspace (in other words, I don't want a lame eg: loading:##########################

我已经阅读了相关主题,我听说过的最佳解决方案涉及实际重写 IDE 基本代码,它只是一个 tkinter 应用程序.我只是不明白为什么需要这样做……他们是否认为在标准 python IDE 中拥有这样的功能是一个愚蠢的功能?令人费解

I've read threads on this and the best solution I've heard involves actually re-writing the IDE base code which is just an tkinter app. I just don't understand why this would be required ... did they think it was a stupid feature to have a function like this in the standard python IDE? Mind-baffling

推荐答案

在我看来,您想要一个GUI"(通常发音为gooey")小部件.那代表图形用户界面.Python 通常在基于文本的界面(也称为命令行界面 (CLI))中运行.CLI 应用程序是他们在发明计算机鼠标和发明更好的图形设备之前拥有的那种无聊的 1980 年代风格的终端.如果您希望进度条看起来现代(我对不蹩脚"的解释),您将必须创建一个 GUI.如果您使用特殊工具,Python 也可以做到这一点.您需要一个 GUI 框架.此处列出了一些优秀的 GUI 框架.不同的框架就像不同的工具.我建议将 tk 和 ttk 用于初学者(TKinter 和主题 TKinter),您可以获得该版本的进度条 这里.

It sounds to me like you want a 'GUI' (often pronounced 'gooey') widget. That stands for Graphical User Interface. Python normally runs in a Text-Base Interface aka command-line interface (CLI). CLI applications are the sort of boring 1980s style terminal things that they had around before they invented the computer mouse and invented better graphics devices. If you want a progress bar to look modern (my interpretation of 'not lame'), you will have to create a GUI. Python can do this too, if you use special tools. You need a GUI framework. Some good GUI frameworks are listed here. Different frameworks are like different tools. I would recommend using tk and ttk for starters (TKinter and themed TKinter), and you can get that version of the progressbar here.

所以实际实现 GUI 总是一团糟.它真的很复杂,而且很难编程.无聊的 1980 年代风格的 CLI 终端应用程序的价值在于它们更易于编程.

So actually implementing GUIs is always a mess. It is really complicated and very difficult to program. That is the value of the boring 1980s style CLI terminal applications is that they are much simpler to program.

如果您仍然决定需要一个 GUI 应用程序,您应该查看教程,甚至是 GUI 构建器.请参阅此堆栈溢出线程和此网站.

If you still decide you want a GUI app, you should check out a tutorial or maybe even a GUI-builder. See this stack overflow thread and this website.

这篇关于python 3空闲进度条/加载条的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆