How do I make a text box in pygame? [duplicate]

2019-08-25 00:42发布

This question already has an answer here:

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

any help much appreciated :)

1条回答
一夜七次
2楼-- · 2019-08-25 01:19

PyGame is low-level library and it doesn't have widgets.

You can use other modules like PGU, OcempGUI or SGC. Most of them have examples.

Most of them use own event loop so you have to learn how to use it instead of loop while True:.

See more on PyGame page:


BTW:

SGC doesn't use own event loop and it shows how to use it in own mailoop in Getting Started

PGU uses own event loop but it shows how to use it in own mainloop (only) in example 10

查看更多
登录 后发表回答