[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] draw text and rectangle with pygame



Wouldn't you rather puzzle it out yourself? :)

Here's a generic technique without spoiling your fun.

1. Create your drawing surface. (Check PyGame tutorials for tips.)
2. Figure out how much space your text needs. (Hint: Font.size.)
3. Render your text. (Hint: Font.render.)
4. Copy your rendered text to the drawing surface. (Hint: Surface.blit.)

Gumm

On Sun, May 3, 2009 at 10:14 AM, He Jibo <hejibo@xxxxxxxxx> wrote:
> Hello,
> Could anyone please give me some hint on how to draw text and box in
> the same screen with pygame? If you can share me some sample code,
> that would be great! I wish I could draw a screen looks like the one
> in the following link, that would be great!
>
> https://cid-bbc15003189d7799.skydrive.live.com/self.aspx/Public/Screen.GIF
>
> Thank you so much ! Have a nice weekend!
>