Python Forum
[PyGame] text-to-screen help
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[PyGame] text-to-screen help
#1
hey I want to blit user input to screen, I know how to blit text:

(example, not real code)

text = font.render("Enter Text Here", True, color)
screen.blit(text,(position))

So, i put in:

(example, not real code)

input_variable = input("prompt")

text = font.render(input_variable, True, color)
screen.blit(text,(position))

but then a message comes up saying
"TypeError: text must be string or unicode"
it's talking about the line where I define text because input_variable is not in quotes, but when I put it in quotes the text appears the literal words input_variable. how do I fix this
Reply


Messages In This Thread
text-to-screen help - by Zman350x - Jan-11-2017, 09:47 PM
RE: text-to-screen help - by ichabod801 - Jan-11-2017, 09:49 PM
RE: text-to-screen help - by Zman350x - Jan-11-2017, 09:53 PM
RE: text-to-screen help - by metulburr - Jan-11-2017, 10:04 PM
RE: text-to-screen help - by Zman350x - Jan-12-2017, 09:04 PM
RE: text-to-screen help - by metulburr - Jan-12-2017, 09:52 PM
RE: text-to-screen help - by Zman350x - Jan-12-2017, 10:29 PM
RE: text-to-screen help - by metulburr - Jan-12-2017, 10:42 PM
RE: text-to-screen help - by Windspar - Jan-12-2017, 11:41 PM
RE: text-to-screen help - by Zman350x - Jan-13-2017, 12:27 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  [PyGame] When I hit the space bar from the home screen, it sends me to the game over screen JesusisKing 1 954 Apr-30-2023, 10:11 PM
Last Post: deanhystad

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020