Linux与ctypes.windell.kernel32.setConsoleItlew的等价物是什么

2024-04-18 19:16:57 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在使用ubuntu 20.0.4

我是linux编程的新手。需要帮助找出什么是linux的ctypes.windll.kernel32.SetConsoleTitleW


Tags: ubuntulinux编程ctypes新手windllkernel32setconsoletitlew
1条回答
网友
1楼 · 发布于 2024-04-18 19:16:57

使用Xterm控制序列

import sys
sys.stdout.write(b'\33]0;title you want\a')
sys.stdout.flush()

你可以做这项工作,但你可以做得更好

在Python3.x中

print('\33]0;title you want\a', end='')
sys.stdout.flush()

或者使用python 3.3或更高版本

print('\33]0;title you want\a', end='', flush=True)

sys.stdout.buffer.write(b'\33]0;title you want\a')
sys.stdout.buffer.flush()

相关问题 更多 >