如何在pygame中制作文本框? [英] How do I make a text box in pygame?
问题描述
所以我是 pygame 的新手,我想知道如何制作一个基本的文本框
So I’m new with pygame and I was wondering how do you make a basic text box
我知道你必须像这样创建一个窗口:
I know you have to create a window as so:
import pygame, sys
pygame.init()
screen= pygame.display.set_mode([800,600])
pygame.display.flip
但是我不知道从那里去哪里
but then I have no idea where to go from there
非常感谢任何帮助:)
推荐答案
PyGame 是低级库,它没有小部件.
PyGame is low-level library and it doesn't have widgets.
您可以使用其他模块,例如 PGU、OcempGUI 或 SGC.他们中的大多数都有例子.
You can use other modules like PGU, OcempGUI or SGC. Most of them have examples.
他们中的大多数使用自己的事件循环,所以你必须学习如何使用它而不是循环while True:
.
Most of them use own event loop so you have to learn how to use it instead of loop while True:
.
在 PyGame 页面上查看更多信息:
See more on PyGame page:
顺便说一句:
SGC
不使用自己的事件循环,它展示了如何在 入门
SGC
doesn't use own event loop and it shows how to use it in own mailoop in Getting Started
PGU
使用自己的事件循环,但它在 示例 10
PGU
uses own event loop but it shows how to use it in own mainloop (only) in example 10
这篇关于如何在pygame中制作文本框?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!