1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
| def licence():
global texte_imp
print "Licence"
filewin = Toplevel(root)
tex1 = Label(filewin, text='Licence \n', fg='black')
tex1.pack()
S = Scrollbar(filewin)
T = Text(filewin, height=80, width=100)
S.pack(side=RIGHT, fill=Y)
T.pack(side=LEFT, fill=Y)
S.config(command=T.yview)
T.config(yscrollcommand=S.set)
texte_imp = """Ceci est mon texte abrégé pour effectuer un test d'impression
Article 12.
Sauf lorsqu'explicitement prévu par la Loi ou accepté par écrit, ni le détenteur des droits, ni quiconque autorisé à modifier et/ou redistribuer le Programme comme il est permis ci-dessus ne pourra être tenu pour responsable de tout dommage direct, indirect, secondaire ou accessoire (pertes financières dues au manque à gagner, à l'interruption d'activités ou à la perte de données, etc., découlant de l'utilisation du Programme ou de l'impossibilité d'utiliser celui-ci). """
T.insert(END, texte)
bouton1=Button(filewin,text=' Ok ',command=filewin.destroy)
bouton2=Button(filewin,text='Imprimer',command=imprimer)
texte = Label(filewin, text="", fg='black')
texte.pack()
bouton1.pack()
bouton2.pack()
mainloop( )
def imprimer():
import os
print 'Imprimer'
modele_commande = 'cat %s | lpr'
commande = modele_commande %(texte_imp)
os.popen(commande) |
Partager