Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 getting input from user to display on pygame screen
Index -> Programming, Python -> Python Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
shaon




PostPosted: Thu Jan 31, 2008 10:12 pm   Post subject: getting input from user to display on pygame screen

In python I know that in order to get text input from the user we can use raw_input or input(). However, these methods are a bit awkard when part of a program that uttilizes pygame. I'm trying to build a reader that stores the inputs internally, and so far I have one working by checking the event que for KEYUP. KEYUP however returns the values of the key being pressed numerically, and not in characters or text for that matter. The method key.name(num) returns a description of the key being pressed. This works for keys from a-z and 0-9 since the description for "a" is "a", however for such keys as space, key.name() gives back "space" even though what is needed is " ". So my question is does anybody know a built-in-function or method in pygame which converts numerical values returned from event.KEYUP or event.KEYDOWN into characters.
Sponsor
Sponsor
Sponsor
sponsor
syntax_error




PostPosted: Thu Jan 31, 2008 10:17 pm   Post subject: Re: getting input from user to display on pygame screen

not totally sure here but look up casting? quick google search might help
McKenzie




PostPosted: Sat Feb 02, 2008 9:35 am   Post subject: RE:getting input from user to display on pygame screen

Ya shaon, it's simply chr.
e.g. x = chr(65)
x will have a value of 'A'
Display posts from previous:   
   Index -> Programming, Python -> Python Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 3 Posts ]
Jump to:   


Style:  
Search: