Impresion multiplataforma
Juan M. Puertas
juatman_2000 en yahoo.es
Sab Feb 18 22:26:25 CET 2006
¡¡¡ Muchas gracias a todos !!!
Siguiendo vuestros trucos y consejos, además de los archivos de esta y
otras listas, he confeccionado un mini-programa capáz de imprimir con
wxpython - de manera multi-plataforma - un círculo con un texto muy original
dentro.
He aquí el código completo:
____________________________________________________
from wxPython.wx import *
modules ={}
class MyPrintout (wxPrintout):
def __init__ (self, func): wxPrintout.__init__ (self); self.func = func
def OnPrintPage (self, n): return self.func (self, n)
def OnPrintPage (PrintOutObj, n):
dc = PrintOutObj.GetDC()
dc.BeginDrawing ()
dc.DrawCircle (400,400,300)
dc.SetMapMode(wxMM_TEXT)
facename = 'Arial'
# wxFont( tamaño, familia, italica, bold, subrayado, tipo)
dc.SetFont(wxFont(48, wxMODERN, wxNORMAL, wxNORMAL, false, facename)) #
s = "HOLA"
fte = dc.GetFullTextExtent(s) #
posx = 300
posy = 500
dc.DrawText(s, posx, posy) #
dc.EndDrawing ()
return true
def main():
app = wxPySimpleApp ()
frm = wxFrame (None, -1, "Main Frame")
frm.Show ()
prn = wxPrinter ()
po = MyPrintout (OnPrintPage)
prn.Print (None, po, true)
if __name__ == '__main__':
main()
______________________________________________
LLama Gratis a cualquier PC del Mundo.
Llamadas a fijos y móviles desde 1 céntimo por minuto.
http://es.voice.yahoo.com
Más información sobre la lista de distribución Python-es