私は実行に時間がかかるPythonスクリプトを持っています。私は、AJAXリクエストのためにブラウザで得られる渦巻き円のように、少し待っているアニメーションをコマンドラインに出力したいと思っています。 '\'の出力のようなものは、テキストが円で丸くなっているように、 '|'、次に '/'、 ' - '、 '|'などで置き換えられます。私はPythonで以前に印刷されたテキストをどのように置き換えるかについてはわかりません。コマンドプロンプト(Python)で 'Waiting' animation
8
A
答えて
15
使用\r
と印刷せずに、改行(つまり、カンマと接尾辞です):
animation = "|/-\\"
idx = 0
while thing_not_complete():
print animation[idx % len(animation)] + "\r",
idx += 1
time.sleep(0.1)
-1
Pythonに組み込まれているcursesパッケージには、端末の画面に表示される内容を制御するためのユーティリティが含まれています。
-1
たぶん、あなたはそれが私のためにクラッシュし、この
import time
import os
def getdot(val):
a=["",".","..","..."]
return a[val]
while True:
l=0
while l<4:
os.system("title Loding %s"%(getdot(l)))
os.system("cls")
print "\n\n\n\n\t\t\t\tLOADING %s"%(getdot(l))
l+=1
time.sleep(1)
関連する問題
- 1. Waiting():プロセススケジューリング
- 2. コマンドプロンプトのPythonコマンド
- 3. コマンドプロンプトのPythonパス
- 4. Swift、dispatch_group_wait not waiting
- 5. Python 2とPython 3 - コマンドプロンプトで実行
- 6. Python Seleniumがリクエストを送信し、「Waiting for(website)....」を避ける
- 7. promise async waiting with without callback
- 8. Observable Waiting for Observable subscribe to finish
- 9. ウィンドウはPythonのコマンドプロンプトのようです
- 10. エラーpipコマンドプロンプトでコマンドプロンプトをインストール
- 11. サーバクライアントコミュニケーションフリーズ[コマンドプロンプト]
- 12. matplotlib animation closeイベント
- 13. コマンドプロンプトからPythonスクリプトを実行する
- 14. java.lang.Thread.Stateの90%スレッドの分析:WAITING(パーキング)
- 15. django1.9は、コマンドプロンプトで
- 16. ApplicationBar Animation
- 17. UISwipeGestureRecognizer animation
- 18. BezierPath animation
- 19. NStimer animation
- 20. SpriteKit animation
- 21. jquery animation
- 22. Kaczmarz animation
- 23. UIImageView animation
- 24. VideoView Animation
- 25. コマンドプロンプト
- 26. コマンドプロンプト
- 27. WindowsのコマンドプロンプトでPythonファイルを実行できません
- 28. コマンドプロンプトの端末で開始pythonの場合は、Windows
- 29. Pythonはコマンドプロンプトで動作しませんか?
- 30. コマンドプロンプトでPython printコマンドが何も出力していない
からいくつかの助けを得るでしょう。 –
私にとって素晴らしい作品です( 'thing_not_complete()'を 'True'に変更すると)、素晴らしいアニメーションです! – Sarah
[ここ](http://code.activestate.com/recipes/534142-spin-cursor/)はあらかじめ焼いたものです。 –