How can move terminal cursor in Python? [closed]
Asked Answered
P

1

8

I'm making Tetris game with Python in Linux, but I can't move terminal cursor to what I want to position

How can move cursor position?? in Python

Pic answered 11/2, 2019 at 12:36 Comment(5)
You need to post your code and specify which part of your code is not working.Arissa
Does this answer your question? How to change the location of the pointer in python?Dragoon
this post does not lack details or clarity. it is clear what OP wants. It should instead be closed as a duplicate of #27613045Tendency
@Neuron: Generally on Stack Overflow we tend to not reopen a question just for close it with another reason. You could leave a comment about what close reason seems to be better in your opinion, but reopening a question mostly wastes a time and a gives a risk to leave a question opened. You may find discussions on this topic on meta: meta.#263261Galactometer
@Galactometer thanks for the info. I retracted my voteTendency
S
14

This seems like a duplicate, however referring to this answer, it appears that you should be using the colorama module to make this task easier and after doing so you should be able to move your cursor around by simply using

def move (y, x):
    print("\033[%d;%dH" % (y, x))
Soleure answered 11/2, 2019 at 12:46 Comment(1)
For it to work for me, I had to use sys.stdout.write() instead of print()Percaline

© 2022 - 2024 — McMap. All rights reserved.