I am working on a RPG game using Python and Pygame, and am trying to make a two-part GUI, including a lower part that is like the basic command line, and a top part that will show all graphical "action."

What I need to find out is a way to include both in a pygame window, instead of using a pygame window and terminal window. As well, are there any Pygame GUI toolkits that would be appropriate for this use?

Thanks All!

有帮助吗?

解决方案

May I suggest using ezText instead? It's a cool way to add text inupt bars to pygame. I used it before my self, and It's really easy to use.

http://www.pygame.org/project-EzText-920-.html

(feel free to leave a comment if you want help using it, although everything you need to know is in the example.py that comes with it)

其他提示

Take a look here (http://wiki.python.org/moin/PythonGameLibraries) for a whole list of ToolKits for both Pygame and Pyglet. Albow (http://www.cosc.canterbury.ac.nz/greg.ewing/python/Albow/) has worked well for me in the past.

The easiest way to accomplish what you're talking about would be to make two Surfaces, one for each part of the interface, and then constantly update them in separate modules to finally blit them every frame. That way your main module can be simplified to something like:

import action_gui
import cl_gui
import pygame

pygame.init()
MAIN_SURF = pygame.display.set_mode((x, y))
pygame.display.set_caption('My Game')

while (True):
    action_surf = action_gui.update()
    cl_surf = cl_gui.update()
    MAIN_SURF.blit(action_surf, my_position_1)
    MAIN_SURF.blit(cl_surf, my_position_2)

Best of luck.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top