Пример #1
0
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()
Пример #2
0
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()
Пример #3
0
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()
Пример #4
0
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()
Пример #5
0
def plot2dMulti(fs, **kwargs):

    windows = []
    for x in xrange(len(fs)):
        windows.append(GlWindow(600, 600, 'Number %d' % x))

    app = GlApplication()

    plotters = []
    for window in windows:
        app.windows.append(window)
        plotter = plotter2d.Plotter(**kwargs)
        plotters.append(plotter)
        window.set_controller(plotter)

    app.init()

    for x in xrange(len(fs)):
        f = fs[x]
        plotter = plotters[x]
        f(plotter)

    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()
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()
Пример #8
0
		#	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()