I've never tried this before, but it also seems that pyglet.app can work fine in a plain old Thread:
import pyglet from threading import Thread window = pyglet.window.Window(resizable=True) thread = Thread(target=pyglet.app.run) thread.start() @window.event def on_draw(): window.clear() @window.event def on_resize(w, h): print(w, h) On Wednesday, July 18, 2018 at 4:50:42 AM UTC+9, stho...@wellesley.edu wrote: > > Hey all, new here. > I'm a student working on a project that basically boils down to > creating/modifying an easy-to-use graphics package for intro programming > students. More specifically I'm tasked with modifying this package called > cs1graphics <http://www.cs1graphics.org/>to have a better backend than > TKinter, which amounts (right now) to essentially taking the front-end > class structure and filling in the backend with pyglet. > > However one of the key parts of cs1graphics (that I'm told is essential) > is its ability to use the REPL to modify existing windows. (For the record, > these are all in an interpreter, never from the command line). The way I > understand pyglet, you need to use app.run() in order to get windows to > display and update properly, however this means the REPL is unusable while > the window is open (which makes sense given that most devs probably don't > want people to mess around with things while their app is running). > > I've tried solving this problem by making my own REPL-like thing in the > window, but that doesn't particularly fly because of the way the class > materials are structured. > > My questions are: > > 1. Is there a way to make the REPL usable while an app is running/ a > window is open? I'll add that event handling isn't necessary as its not > covered in the class, but because of the nature of the package the window > *will* need to be able to update > > and/or: > > 2. if it isn't viable, why wouldn't it work? (just so I can explain to my > supervisors what's up.) > > Please bear with me as I'm very new to this and don't quite know correct > terminology yet. Let me know if I need to clarify/rephrase things, too. I'd > appreciate any help I can get with this! > > -Sadie > -- 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 pyglet-users+unsubscr...@googlegroups.com. To post to this group, send email to pyglet-users@googlegroups.com. Visit this group at https://groups.google.com/group/pyglet-users. For more options, visit https://groups.google.com/d/optout.