作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试显示一个网格,其中包含移动的个体。目前我使用“清晰屏幕”然后显示网格。这很困惑,因为屏幕每次都会“闪烁”。
在 C 和 VB.NET 中,有一些方法可以强制回车返回控制台的开头并覆盖内容。这消除了闪烁。
Python 可以做到这一点吗?我用 Google 搜索了一下,找到了 Curses,但那只是 Unix(我将主要在 Windows 中工作)。
当前网格代码( super 基本):
#Clear() is a OS indepedent method of clearing the screen defined in code above, in windows its just os.system('cls')
clear()
x=0
y=0
tiles=""
tile=""
# Generate grid
while(y<max_y):
while(x<max_x):
tile = tileGen(x,y)
tiles += str(tile)
x+=1
tiles += "\n"
y+=1
x=0
print(tiles)
最佳答案
也许这会有所帮助:ANSI Escape Sequences
Home 命令将为'\x1b[0;0H'
。
关于python - 在 Python 2.6 中将回车符返回到 0,0,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9552315/
到目前为止,我已经生成了以下代码来尝试将相关数据整合在一起。 但是,使用“+ 7”函数会产生以下问题。 Registration date = '2018-01-01' 它正在推迟 2018-04-0
我已经成功地将我的自定义购物车发布到 PayPal——它处理订单非常漂亮,当收到付款时,它会将数据发回我在配置中指定的 URL。代码基于此处找到的库:http://www.phpfour.com/bl
我是一名优秀的程序员,十分优秀!