On Sat, Jul 11, 2009 at 11:04 AM, Woodwolf <[email protected]> wrote:

>
> I'm having quite a silly problem here: after finishing a game, I
> wanted to add a highscore table. I already have all the code for this
> table, which properly handles a certain number of sorted entries,
> saves and loads data to a file and does all that a classic highscore
> table should do. I'm still learning Python, so the code may not be too
> pythonic, I fear... but I leave it here just in case someone is even
> more lost than me :)
>
> It's quite easy to use, although you have to draw it yourself.  You
> create an instance, specifying the number of entries in the table.
> Then it attempts to load an existing table from disk, creating a table
> full of dummy records if no file is found. When the game ends,
> check_score should be called to check if the user's score is high
> enough to enter the table...
>
> ...and here's where I have my problem. If it is a new record, the user
> should enter her name. But how? I was playing with a text widget like
> those in text_input.py, with its layout and caret for text input...
> But I just can't control it properly. I don't get it, it is something
> mystical for me, that 'caret' thing. I can't find what I'm doing
> wrong, but nothing appears on screen when I type. So, my question is:
> does anyone know a self-contained solution to handle text input for
> something as simple as registering your name? Otherwise I think I'll
> create an object with its own keyboard handlers and control everything
> myself :(


The caret object handles a lot of functionality that is a pain to roll on
your own. Rather than trying to use the text widget from text_input.py, I
would take the whole Window class, make it no longer a subclass on window,
and use that.

Otherwise, grab one of the many GUI toolkits that have recently sprung up -
they should all effortlessly support text input widgets.

-- 
Tristam MacDonald
http://swiftcoder.wordpress.com/

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pyglet-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/pyglet-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to