示例#1
0
def printWindow(fname):
    "printWindow(fname) - use mouse click the drawing area and send the window to PS printer"
    if os.name == 'posix':
        print 'click the window'
        if os.path.isfile('1.gif'):
            os.system('rm 1.gif')


#    os.system('window2gif > 1.gif')
        os.system(
            'xwd -frame -nobdrs | xwdtopnm | pnmquant 256 | ppmtogif > 1.gif')
        im = Image.open('1.gif')
        if im.mode == 'P':
            im2 = im.convert("RGB")
            im2.save('1.png')
            os.system('mv 1.png 1.gif')
        if os.path.isfile('SH'):
            SH = readSH()
            if SH['printer'] == '':
                os.system('pilprint.py -c -p 1.gif')
            else:
                os.system("pilprint.py -c -p -P " + SH['printer'] + " 1.gif")
        else:
            os.system('pilprint.py -c -p 1.gif')
    else:
        grabImage(fname)
示例#2
0
文件: tv.py 项目: eddienko/SamPy
    def Print(self):
        "for python2.3 on unix it only works for png,jpg not for gif"
	from plotAscii import readSH
	print self.im.mode
	SH = readSH()
	printer = SH['printer']
	fn = 'out.png'
	im = self.im
	im.save(fn)
	if os.name == 'posix':
	  if printer != '':
	    str="pilprint.py -c -p -P %s %s" % (printer,fn)
	  else:
	    str="pilprint.py -c -p %s" % fn
	else:
	  if printer != '':
	    str="python pilprint.py -c -p -P %s %s" % (printer, fn)
	  else:
	    str = "python pilprint.py -c -p %s" % fn
	print str
	os.system(str)
示例#3
0
 def Print(self):
     "for python2.3 on unix it only works for png,jpg not for gif"
     from plotAscii import readSH
     print self.im.mode
     SH = readSH()
     printer = SH['printer']
     fn = 'out.png'
     im = self.im
     im.save(fn)
     if os.name == 'posix':
         if printer != '':
             str = "pilprint.py -c -p -P %s %s" % (printer, fn)
         else:
             str = "pilprint.py -c -p %s" % fn
     else:
         if printer != '':
             str = "python pilprint.py -c -p -P %s %s" % (printer, fn)
         else:
             str = "python pilprint.py -c -p %s" % fn
     print str
     os.system(str)
示例#4
0
文件: view2d.py 项目: eddienko/SamPy
def printWindow(fname):
  "printWindow(fname) - use mouse click the drawing area and send the window to PS printer"
  if os.name == 'posix':
    print 'click the window'
    if os.path.isfile('1.gif'):
    	os.system('rm 1.gif')
#    os.system('window2gif > 1.gif')
    os.system('xwd -frame -nobdrs | xwdtopnm | pnmquant 256 | ppmtogif > 1.gif')
    im = Image.open('1.gif')
    if im.mode == 'P':
		im2 = im.convert("RGB")
		im2.save('1.png')
		os.system('mv 1.png 1.gif')
    if os.path.isfile('SH'):
 	SH = readSH()
	if SH['printer'] == '':
	  os.system('pilprint.py -c -p 1.gif')
	else:
	  os.system("pilprint.py -c -p -P "+SH['printer'] +" 1.gif")
    else:
	  os.system('pilprint.py -c -p 1.gif')
  else:
	grabImage(fname)