def plot2d(f, width=600, height=600, dark=False, screenshot_file_name=None, **kwargs): window = GlWindow(width, height, 'plot') app = GlApplication() app.windows.append(window) if not 'color_scheme' in kwargs: kwargs['color_scheme']=DEFAULT_COLORS if not dark else BLA_COLORS plotter = plotter2d.Plotter( **kwargs) plotter.on_keyboard.append(ScreenshotKeyboardHandler(window, screenshot_file_name)) window.set_controller(plotter) app.init() f(plotter) app.run()
def plot2dCustom(f, plotters, fake=None, width=600, height=600, window_title='', **kwargs): window = GlWindow(width, height, window_title) app = GlApplication() app.windows.append(window) controller = FramelayoutController(plotters) if hasattr(f, 'pre_cycle'): controller.on_pre_cycle.append(f.pre_cycle) window.set_controller(controller) app.init() f(plotters) app.run()
def plot2dRows(f, plotters, width=600, height=600, dark=False): window = GlWindow(width, height, '2 cool quads 4 yolo') app = GlApplication() app.windows.append(window) if dark: for plotterargs in plotters: plotterargs['color_scheme']=BLA_COLORS plotters = [plotter2d.Plotter(**args) for args in plotters] window.set_controller(FramelayoutController([[c] for c in plotters])) app.init() f(plotters) app.run()
def plot2dColumns(f, plotters, width=600, height=600, dark=False): window = GlWindow(width, height, '2 cool quads 4 yolo') app = GlApplication() app.windows.append(window) if dark: for plotterargs in plotters: plotterargs['color_scheme']=BLA_COLORS plotters = [plotter2d.Plotter(**args) for args in plotters] def bla(): print('CYCLE') controller = FramelayoutController([[c for c in plotters]]) if hasattr(f, 'pre_cycle'): controller.on_pre_cycle.append(f.pre_cycle) window.set_controller(controller) app.init() f(plotters) app.run()
from gllib.application import GlApplication, GlWindow from gllib.plot.plotter2d import Plotter, DEBUG_COLORS, DARK_COLORS from gllib.framelayout import FramelayoutController, LayoutRow, LayoutColumn from gllib.plot.domain import RealAxis from gllib.plot.graph import Line2d application = GlApplication() GlApplication.DEBUG=False window = GlWindow(900, 900) application.windows.append(window) domain = RealAxis() graph = Line2d(domain, "y=sin(10*x)") layout = FramelayoutController([ [Plotter(graphs={'sin': graph}, color_scheme=DARK_COLORS)], [Plotter(graphs={'sin': graph}, color_scheme=DARK_COLORS),Plotter(graphs={'sin': graph}, color_scheme=DARK_COLORS)], [Plotter(graphs={'sin': graph}, color_scheme=DARK_COLORS),Plotter(graphs={'sin': graph}, color_scheme=DARK_COLORS)], ]) window.set_controller(layout) application.run()
'Phi' : u'\u03d5', 'tau' : u'\u03c4', 'phi' : u'\u03d5', 'varphi' : u'\u03a6', 'chi' : u'\u03a7', 'psi' : u'\u03c8', 'omega' : u'\u03c9', 'Psi' : u'\u03a8', 'Omega' : u'\u03a9', 'Int' : u'\u222B', } print(''.join(_LATEX_CHARACTER_MAPPING.values())) application = GlApplication() GlApplication.DEBUG=False window = GlWindow(800, 400) application.windows.append(window) from time import time class TestController(Controller): def __init__(self): Controller.__init__(self) self._rendered = False def init(self): print('INIT') self.ftrenderer = FontRenderer() self.ftrenderer.set_camera(self.camera) self.ftrenderer.init() self._texts = [] h = 20#
from gllib.application import GlWindow, GlApplication from gllib.controller import Controller from gllib.plot.plotter2d import Plotter from gllib.plot.domain import RealAxis from gllib.plot.graph import Line2d app = GlApplication() window1 = GlWindow(200, 200, x=0, y=0) window2 = GlWindow(200, 200, x=0, y=210) def plot_main(plotter): domain = RealAxis(length=100) plotter.graphs["test"] = Line2d(domain, "y=sin(x)") plotter = Plotter() window1.set_controller(plotter) window2.set_controller(Plotter()) app.windows.extend([window1, window2]) app.init() plot_main(plotter) app.run()
# text.set_text('BLALALALA') -> font_render.text_updated(text) # # self.on_text_updated = Event() # # self.on_tect_updated.append(self._text_updated) # # # # def _text_updated(self, text): # # self.update_text(id, 'text', pos) def run(self): #print('RUNRUNRU') glClearColor(*[1,1,1,1]) glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT) #self.font_renderer.modelview.translate(1,1) self.font_renderer.modelview_updated() self.font_renderer.render() # # if self._front # # app = GlApplication() GlApplication.DEBUG = False window = GlWindow(400, 400) app.windows.append(window) window.set_controller(MyCoolController()) app.run()