<rect x="0" y="0" width="400" height="200" rx="50" fill="none" stroke="purple" stroke-width="30" /> </g> </svg> """) renderer = Renderer(xmltree) import svgplotlib.FLTK as Fl WIDTH, HEIGHT = 600, 700 window = Fl.Window(WIDTH, HEIGHT) width, height = renderer.width, renderer.height widget = Fl.Button(10, 10, width, height) pixels = vg.PixelBuffer(width, height) ctx = vg.CreateOffScreenSH() vg.StartOffScreenSH(ctx, width, height) vg.Setfv(vg.CLEAR_COLOR, 4, [1., 1., 1., 1.]) vg.Clear(0, 0, width, height) # center on bounding box box = renderer.bounds scale = min(width / box.width, height / box.height) vg.Seti(vg.MATRIX_MODE, vg.MATRIX_PATH_USER_TO_SURFACE) vg.LoadIdentity()
# -*- coding: utf-8 -*- import sys sys.path.append('..') import svgplotlib.FLTK as Fl def beepcb(widget, data): print 'beep' def exitcb(widget, data): Fl.exit() window = Fl.Window(320, 65, 'Buttons') b1 = Fl.Button(20, 20, 80, 25, "&Beep") b1.callback(beepcb) b3 = Fl.Button(220, 20, 80, 25, "E&xit") b3.callback(exitcb) window.end() window.show() Fl.run()
# -*- coding: utf-8 -*- import sys sys.path.append('..') import svgplotlib.FLTK as Fl def filecb(widget, data): native = Fl.Native_File_Chooser() native.set_title("Pick a file") native.set_filter('''Text\t*.txt C Files\t*.{cxx,h,c} Apps\t*.{app}\n''') ret = native.show() if ret == -1: print 'Error ', native.errmsg() elif ret == 1: print 'Cancel' else: print native.filename() def exitcb(widget, data): Fl.exit() window = Fl.Window(320,65) b1 = Fl.Button(20, 20, 80, 25, "&Select file") b1.callback(filecb) b3 = Fl.Button(220,20, 80, 25, "E&xit") b3.callback(exitcb) window.end() window.show() Fl.run()
# -*- coding: utf-8 -*- import sys sys.path.append('..') import svgplotlib.FLTK as Fl window = Fl.Window(320, 320) b1 = Fl.Button(10, 10, 300, 300) image1 = Fl.PNG_Image('sudoku-128.png') b1.image(image1) window.end() window.show() Fl.run()