Hello,
Wouldn't both of these problems be fixed if there was a proper App class?
Tell people to have this at the top of their script:
import pyglet
my_app = pyglet.App(caption="My test app")
#code
my_app.run()
Inside the App class you have window, clock and everything is
sub-classed or has an instance of event_loop so you can just do:
def on_key_press(key, mods):
pass
my_app.set_handlers(on_key_press)
This is just a new-comer's idea of what would be practical and make a
whole lot more sense than what is going on currently.
Would it be against any principals to add an App class with this
functionality?
Thanks,
Brandon Keith Biggs <http://www.brandonkeithbiggs.com/>
On 3/10/2015 10:23 AM, Richard Jones wrote:
I believe Brandon meant to say "explicit", since his example is
certainly more explicit than the current pyglet behaviour.
For the record, I argued against the implicit behavior. It's related
to the automatic shadow window which has caused a bunch of issues over
time. On the other hand, we don't (generally, when the shadow window
works) get errors from people loading images before there's a valid GL
context. So it's a tough call to make. And in the end Alex had the
final say, and I think he was right to err on the side of
programmer-friendliness, so that's why we have it now.
On Tue, 10 Mar 2015 at 19:09 Adam Bark <[email protected]
<mailto:[email protected]>> wrote:
That would seem to be unpythonic as it contradicts the zen of
python "explicit is better than implicit"
On 10 Mar 2015 08:05, "Brandon Keith Biggs"
<[email protected] <mailto:[email protected]>>
wrote:
Hello,
I am wondering if there is a way to make the window and app
more implicit in pyglet? Something like:
import pyglet
my_app = pyglet.app() #is the window, just under the name of app
my_app.run()
or:
import pyglet
window = pyglet.window.Window()
pyglet.app.window = window
pyglet.app.run()
As it is right now, it is not pythonic at all and I am
wondering if there was a good reason for this? Also, is there
a way to make it more implicit?
If not, I can create a wrapper class over it to make it more
pythonic, but I would rather not...
thanks,
--
Brandon Keith Biggs <http://www.brandonkeithbiggs.com/>
--
You received this message because you are subscribed to the
Google Groups "pyglet-users" group.
To unsubscribe from this group and stop receiving emails from
it, send an email to [email protected]
<mailto:[email protected]>.
To post to this group, send email to
[email protected]
<mailto:[email protected]>.
Visit this group at http://groups.google.com/group/pyglet-users.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google
Groups "pyglet-users" group.
To unsubscribe from this group and stop receiving emails from it,
send an email to [email protected]
<mailto:[email protected]>.
To post to this group, send email to [email protected]
<mailto:[email protected]>.
Visit this group at http://groups.google.com/group/pyglet-users.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google
Groups "pyglet-users" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to [email protected]
<mailto:[email protected]>.
To post to this group, send email to [email protected]
<mailto:[email protected]>.
Visit this group at http://groups.google.com/group/pyglet-users.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups
"pyglet-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/pyglet-users.
For more options, visit https://groups.google.com/d/optout.