pygame 与 tkinter. [英] pygame vs tkinter.

查看:144
本文介绍了pygame 与 tkinter.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在网上搜索并阅读有关 Python 中 GUI 开发的信息,并了解到 Tkinter 是 Python 的最佳 GUI 工具包之一.但我也知道 Pygame 是一个可用于 GUI 的库.由于我对编程还很陌生,有人可以解释一下 Pygame 和 Tkinter 之间的区别,以及应该在什么场合使用.对于国际象棋引擎 GUI,这将是更好的选择.非常感谢您提前.

I've been searching the web and reading about GUI development in Python and have read that Tkinter is one of the best GUI toolkits for Python. But I also know that Pygame is a library that can be used for GUI. As i'm fairly new to programming, could somebody please explain the differences between Pygame and Tkinter, and which should be used in what occasion. Which would be a better choice for a chess engine GUI. Thank you very much in advance.

推荐答案

首先,tkinter 绝对不是 Python 的最佳 GUI 工具包.它是最简单的之一,通常与 python 解释器一起提供.但不如Qt、wx或Gtk强大.

First, tkinter is definitely not the best GUI toolkit for python. It's one of the simplest and usually comes with the python interpreter. But it's not as powerful as Qt, wx or Gtk.

pygame 是——顾名思义——一个包,旨在允许非常容易地在 python 中创建游戏,而不是创建 GUI.因此,它提供了事件处理、图形声音绑定和其他一些对编写游戏有用的东西,它是在 SDL.

pygame is - as it's name states - a package designed to allow to create games in python very easily, not to create GUIs. As such it provides event handling, graphics sound bindings and some other things useful to write games, and it's written on top of SDL.

因此,如果您想编写 GUI 应用程序,请不要使用 pygame.

So if you want to write a GUI-application, don't use pygame.

另一方面,GUI 工具包也可用于编写游戏.一般来说,我会说它们比 pygame 更通用,但它们并没有真正的可比性.这完全取决于您要编写的应用程序.选择正确的工具通常非常重要.

On the other hand GUI toolkits can also be used to write games. Generally I would say they are much more versatile then something like pygame, but they're not really comparable. It all depends on the application you want to write. The choice of the right tool is usually something very important.

这篇关于pygame 与 tkinter.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆