What can Pygame do in terms of graphics that wxPython can't?

前端 未结 2 1552
醉梦人生
醉梦人生 2021-02-19 00:58

I want to develop a very simple 2D game in Python. Pygame is the most popular library for game development in Python, but I\'m already quite familiar with wxPython and feel comf

2条回答
  •  灰色年华
    2021-02-19 01:52

    wxPython is based on wxWidgets which is a GUI-oriented toolkit. It has the advantage of using the styles and decorations provided by the system it runs on and thus it is very easy to write portable applications that integrate nicely into the look and feel of whatever you're running. You want a checkbox? Use wxCheckBox and wxPython will handle looks and interaction.

    pyGame, on the other hand, is oriented towards game development and thus brings you closer to the hardware in ways wxPython doesn't (and doesn't need to, since it calls the OS for drawing most of its controls). pyGame has lots of game related stuff like collision detection, fine-grained control of surfaces and layers or flipping display buffers at a time of your choosing.

    That said, graphics-wise you can probably always find a way to do what you want with both toolkits. However, when speed counts or you wish to implement graphically more taxing game ideas than Tetris, you're probably better off with pyGame. If you want to use lots of GUI elements and don't need the fancy graphics and sound functions, you're better off with wxPython.

    Portability is not an issue. Both are available for the big three (Linux, OSX, Windows).

    It's more a question of what kind of special capabilities you need, really.

提交回复
热议问题