开发者

Text-based game graphics in Python

开发者 https://www.devze.com 2022-12-25 06:51 出处:网络
I开发者_Go百科\'m pretty new to programming, and I\'m creating a simple text-based game.> I\'m wondering if there is a simple way to create my own terminal-type window with which I can place coloured

I开发者_Go百科'm pretty new to programming, and I'm creating a simple text-based game.>

I'm wondering if there is a simple way to create my own terminal-type window with which I can place coloured input etc.

Is there a graphics module well suited to this? I'm using Mac, but I would like it to work on Windows as well

Thanks


The Tkinter Text Widget will do what you ask. the IDLE main window is implemented as one, if you want to play with an example.


You could use the termcolor library - it that what you're looking for?

On Windows things are trickier. See this SO answer - you should resort to win32console and some ctypes. The answer has some code and links to other articles.


For game programming with Python, I would always recommend PyGame. It is not very complex and enables you to easily use input, graphics and sound. As a start:

http://www.penzilla.net/tutorials/python/pygame/

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号