python - Pygame - Is There A Way To Get The String From fontType.render? -


i'm trying print dialogue in box letter letter (like pokemon or rpgs) , i'm wondering if theres way string fonttype.render variable, so:

self.coffee = self.fonttype.render("ooh! french vanilla!", 0, (0,0,0,)) 

i tried doing:

self.coffee[0] 

..but got:

typeerror: 'pygame.surface' object has no attribute '__getitem__' 

i trying avoid making variable string (although might work, seems sloppy or messy how i'm doing rest of code):

dialogue = "ooh! french vanilla!" self.coffee = self.fonttype.render(dialogue, 0, (0,0,0)) 

i hope made myself clear enough, if not let me know. thanks.

the pygame.surface docs suggest object canvas onto text painted. once put text on it, image of text, there wouldn't practical way retrieve once painted (not impossible impractical). i'd go approach of storing dialogue text in variable suggested. tend anyway when posting text sort of prompt or message on screen. i'd rather see this:

dialogue = 'ooh! french vanilla!' self.coffee = self.fonttype.render(dialogue, 0, (0,0,0)) 

than this:

self.coffee = self.fonttype.render('some long dialogue might make me want on 2 lines', 0, (0,0,0)) 

Comments

Popular posts from this blog

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

html - How to style widget with post count different than without post count -

url rewriting - How to redirect a http POST with urlrewritefilter -