K i jddlmZddlmZddlmZmZeZGddeZe dk(reyy))Window)Clock)ThreadLockcReZdZdZdZdddddZdZfd Zd Zd Z d Z d Z xZ S) ManagedWindowz A pyglet window with an event loop which executes automatically in a separate thread. Behavior is added by creating a subclass which overrides setup, update, and/or draw. iXiFT)widthheightvsync resizablec |jddryt|jfi||_t |j |_|jj y)z It is best not to override this function in the child class, unless you need to take additional arguments. Do any OpenGL initialization calls in setup(). runfromdoctesterFN)target)getdictdefault_win_argswin_argsr__event_loop__start)selfrs n/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/sympy/plotting/pygletplot/managed_window.py__init__zManagedWindow.__init__sO <<*E 2 T22?h? D$7$78  c tj t| di|j|j |j tjt}|j|_ |js|j}tj |j |j|j!|j#||j%|j'tj|jst|Qy#t$r)}tdt|zd|_ Yd}~d}~wwxYw#tjwxYw#t$r(}tdt|zd|_ Yd}~d}~wwxYw#tjwxYw)zv The event loop thread function. Do not override or call directly (it is called by __init__). z Window initialization failed: %sTNz$Uncaught exception in event loop: %s)gl_lockacquiresuperrr switch_tosetup Exceptionprintstrhas_exitreleaser fps_limittickdispatch_eventsclearupdatedrawflipclose)rreclockdt __class__s rrzManagedWindow.__event_loop__$sS   % 14==1  OO ..--B OO  " )NN$((*JJLKKOIIKIIK !--  1 %8CFCD $  % OO !)@3q6IJ$(DMM)!sT9E2A!F E5 E0*E80E55E88F GF=8G=GGGcd|_y)z$ Closes the window. TN)r%rs rr.zManagedWindow.closeIs  rcy)z Called once before the event loop begins. Override this method in a child class. This is the best place to put things like OpenGL initialization calls. Nrr4s rr!zManagedWindow.setupO rcy)z Called before draw during each iteration of the event loop. dt is the elapsed time in seconds since the last update. OpenGL rendering calls are best put in draw() rather than here. Nr)rr1s rr+zManagedWindow.updateXr6rcy)z Called after update during each iteration of the event loop. Put OpenGL rendering calls here. Nrr4s rr,zManagedWindow.drawas r) __name__ __module__ __qualname____doc__r'rrrr.r!r+r, __classcell__)r2s@rrr sB I!$&)%*)-/ #J    rr__main__N) pyglet.windowr pyglet.clockr threadingrrrrr9rrrrBs8 " &^ F^ @ zOr