Perhaps the .matplotlibrc file could have lines like
printcommand: None
printcommand: '"lpr %s" % path'
And if printcommand is not None an extra toolbar button is created which
calls
os.system(printcommand)
to print the file.
Steve
···
On Sat, 2004-08-14 at 11:42, matplotlib-devel-request@lists.sourceforge.net wrote:
Hi, I searched for material related to this, but didn't find any, so I
hope this isn't a repeat. One feature that has been missing from
matplotlib that I find really useful is to print my graphs (I generate a
lot, and generally want a hard copy, but not a lot of random files lying
around). While on a unix system this is easy to do, I realize it is
rather difficult to make crossplatform. So instead I've been hacking the
source and adding my own button in. However, with each release this can
get a bit tiresome, so the idea occured to me that it would be nice if I
have a function to add buttons to the toolbar that could then run
arbritrary code.I can submit my code if anyone is interested (it's a very rough hack,
and only for the GTK backend), but the idea is that in my own code I can
just do:def myprint(*args, **kwargs):
fd, path = tempfile.mkstemp(suffix=".eps", dir="/tmp")savefig(path)
print "lpr %s" % path
os.system("lpr %s" % path)os.close(fd)
os.unlink(path)and later on:
add_toolbar_button("print", "prints figure", gtk.STOCK_PRINT, myprint)
I was curious as to what other people thought of this, and whether it
had a chance of ending up in matplotlib (being able to add other widgets
besides buttons would be extra cool).