It will be Real Soon. Just need to flesh out a few more things and
give it a name.
Richard
On 04/08/2009, at 6:11 PM, Nicolas Rougier wrote:
> This seems to be an interesting approach. Is code available
> somewhere ?
>
> Nicolas
>
>
> On Aug 3, 12:37 pm, Richard Jones <[email protected]> wrote:
>> On 03/08/2009, at 5:37 PM, Greg Ewing wrote:
>>
>>> Richard Jones wrote:
>>>> Here's
>>>> a little random thought that I freely license anyone currently
>>>> developing a GUI to run with
>>
>>>> gui = withgui.Window()
>>>> with gui.vertical:
>>>> gui.label('My awesome GUI', halign=gui.CENTER)
>>>> with gui.form:
>>>> gui.label('Name')
>>>> gui.text()
>>
>>> That looks quite nifty! I'll tuck it away somewhere in case
>>> I find a use for it in PyGUI!
>>
>> Cool. For what it's worth, the following is now implemented (using
>> Tkinter) with some slight changes to the proposed API:
>>
>> with gui.vertical:
>> gui.label('My awesome GUI', halign=CENTER)
>> with gui.form as form:
>> gui.label('Name')
>> name = gui.text()
>> gui.help('Enter the name of your character in the game')
>> gui.label('Skill level')
>> skill = gui.selection(['Awesome', 'Radical', 'Understated'])
>> gui.help('''This selection will determine the level of challenge
>> in the game''')
>> with gui.submit('Go!'):
>> def on_click():
>> print 'GOT %r'%name.value
>> print 'GOT %r'%skill.value
>> gui.stop(0)
>> with gui.cancel('No stop!'):
>> def on_click():
>> gui.stop(1)
>>
>> ... this is runnable with "withgui example.py". What's not apparent
>> up
>> there is that I can access the named widgets and other things. So,
>> gui['form']['name'] is the name text widget and gui['form']['.text']
>> is all the text widgets and gui['form'][1] is the selection widget
>> (note the top-level widget is skipped in that 'cos there's only one
>> and you can get it through gui.child).
>>
>> The simplest example is:
>>
>> gui.label('Hello, world!')
>>
>> or:
>>
>> with gui.button('press me!'):
>> def on_click(*args):
>> print 'hello, world!'
>>
>> ... which both do the obvious things :)
>>
>> Note that my originally proposed "gui.cancel('No stop!').on_click"
>> results in a syntax error. It's a shame we can't "def
>> submit.on_click" :(
>>
>> I'm trying to think of more complex examples that would make this
>> approach not be viable. Can't tho.
>>
>> I'll release this code tomorrow when I've got a Google Code project
>> set up. It needs a name tho.
>>
>> Richard
> >
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---