예제 #1
0
    def __init__(self, svg=None, width=500, height=500):
        try:
            WIDTH, HEIGHT = width, height
            super(Viewer, self).__init__(WIDTH, HEIGHT)
            menu = Fl.Menu_Bar(0, 0, WIDTH, 30)

            widget = GLWidget(10, 40, WIDTH - 20, HEIGHT - 50)

            menu.add("&File", 0, None, None, Fl.SUBMENU)
            menu.add("File/&Open", 0, widget.openFile, None, Fl.MENU_DIVIDER)
            menu.add("File/&Quit", 0, lambda widget, data: Fl.exit())

            self.end()
            self.resizable(widget)
            self.show()
            widget.show()
            if not svg is None:
                widget.openFile(filename=svg)
            Fl.run()

        finally:
            vg.DestroyContextSH()
예제 #2
0
def deadViewer(filename=None):
    try:
        WIDTH, HEIGHT = 600, 700
        window = Fl.Double_Window(WIDTH, HEIGHT)
        menu = Fl.Menu_Bar(0, 0, WIDTH, 30)

        widget = GLWidget(10, 40, WIDTH - 20, HEIGHT - 50)

        menu.add("&File", 0, None, None, Fl.SUBMENU)
        menu.add("File/&Open", 0, widget.openFile, None, Fl.MENU_DIVIDER)
        menu.add("File/&Quit", 0, lambda widget, data: Fl.exit())

        window.end()
        window.resizable(widget)
        window.show()
        widget.show()
        if not filename is None:
            widget.openFile(filename=filename)
        Fl.run()

    finally:
        vg.DestroyContextSH()
예제 #3
0
# -*- coding: utf-8 -*-
import sys

sys.path.append('..')
import svgplotlib.FLTK as Fl


def cb(widget, data):
    print 'called'
    print widget, data


WIDTH = 700

window = Fl.Window(WIDTH, 400)
menubar = Fl.Menu_Bar(0, 0, WIDTH, 30)
menubar.add("&File", 0, None, None, Fl.SUBMENU)
menubar.add("File/Exit1", 0, cb, 'test1')
menubar.add("File/Exit2", 0, cb, 'test2')

button = Fl.Menu_Button(10, 50, WIDTH / 2, 30, 'Menu Button')
button.add("Exit1", 0, cb, 'test1')
button.add("Exit2", 0, cb, 'test2')

choice = Fl.Choice(WIDTH / 4, 100, WIDTH / 2, 30, 'Choice Button')
first = choice.add("Exit1", 0, cb, 'test1')
choice.add("Exit2", 0, cb, 'test2')
choice.value(first)

window.end()
window.show()