使用python curses在某个y,x位置更改字符的属性

时间:2018-08-19 03:59:14

标签: python curses

让我们说,像“诅咒世界”一样,文本“ hello world”被打印出来:

@FunctionalInterface
public interface Runnable {
    public abstract void run();
}

public class MethodReference1 {

    public static String ThreadStatus() {
        System.out.println( Thread.currentThread().getName() +  " is running...");
        return "threadname";
    }

    public static void main(String[] args) {
        Thread t1 = new Thread(() -> ThreadStatus());
        t1.start();
    }

}

现在,可以说我希望字母'e'(y,x位置1,0)具有属性stdscr.addstr(0, 0, "hello world") A_BOLD。我该怎么办?是否存在仅在某个y,x位置更改属性的函数?我正在使用带有诅咒的Python3.6(显然)

编辑:我尝试使用chgat,但是它不能正常运行。我这样使用它:

A_REVERSE

但这会使x位置之后的每个单个字符都应用属性。我只希望y,x位置的字符受到影响。

2 个答案:

答案 0 :(得分:0)

Python curses包装器具有chgat的多个变体,具有不同的参数列表。您应该使用的是window.chgat( y x num attr < / em> )

如果要将 back 移至给定位置,则将保存当前位置(由getyx获取,然后对保存的位置执行move位置。

答案 1 :(得分:0)

$sql = 'something';
if ($this->id == $targetCategoryId) { // $targetCategoryId can replace by configuration: Configuration::get('YOUR_CUSTOM_CATEGORY_ID')
    $sql .= 'AND WHERE quantity > 0';
}