Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #96973
| Path | csiph.com!news.swapon.de!newsfeed.fsmpi.rwth-aachen.de!newsfeed.straub-nv.de!proxad.net!feeder1-2.proxad.net!news.tele.dk!news.tele.dk!small.news.tele.dk!newsgate.cistron.nl!newsgate.news.xs4all.nl!nzpost1.xs4all.net!not-for-mail |
|---|---|
| Return-Path | <baladjy@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.000 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'root': 0.04; 'sys': 0.05; '-*-': 0.07; 'canvas': 0.07; 'filename': 0.07; 'meeting.': 0.07; 'utf-8': 0.07; 'cc:addr:python-list': 0.09; "'w')": 0.09; 'coding:': 0.09; 'creighton': 0.09; 'english)': 0.09; 'pil': 0.09; 'skip:# 30': 0.09; 'skip:c 80': 0.09; 'output': 0.13; 'def': 0.13; 'argument': 0.15; '100))': 0.16; 'dialog.': 0.16; 'skip:> 20': 0.16; 'subprocess': 0.16; 'tk()': 0.16; 'app': 0.16; 'laura': 0.18; 'linux,': 0.18; 'widget': 0.18; 'windows': 0.20; '2015': 0.20; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'button,': 0.22; 'os,': 0.22; 'sep': 0.22; 'skip:c 70': 0.22; 'tkinter': 0.22; 'cc:no real name:2**0': 0.22; 'code.': 0.23; 'bit': 0.23; '8bit%:5': 0.23; 'slightly': 0.23; 'tried': 0.24; 'import': 0.24; 'written': 0.24; 'header:In-Reply-To:1': 0.24; 'script': 0.25; "i've": 0.25; "doesn't": 0.26; '(which': 0.26; 'skip:" 20': 0.26; 'skip:_ 20': 0.26; 'skip:m 30': 0.27; 'skip:t 40': 0.27; 'question': 0.27; 'message-id:@mail.gmail.com': 0.27; '+0200,': 0.27; 'img': 0.29; 'skip:m 60': 0.29; 'convert': 0.29; 'push': 0.30; 'somebody': 0.30; 'window': 0.30; 'skip:s 30': 0.31; 'skip:_ 10': 0.32; 'non': 0.32; 'getting': 0.33; 'run': 0.33; 'options': 0.33; 'class': 0.33; 'problem': 0.33; 'curious': 0.33; 'file': 0.34; 'received:google.com': 0.35; 'next': 0.35; 'done': 0.35; 'dir': 0.35; 'label': 0.35; 'skip:" 50': 0.35; "isn't": 0.35; 'but': 0.36; 'skip:i 20': 0.36; '(and': 0.36; 'skip:m 40': 0.36; 'subject:: ': 0.37; 'mac': 0.37; 'pdf': 0.37; 'building': 0.38; 'skip:p 20': 0.38; 'skip:o 20': 0.38; "didn't": 0.39; 'takes': 0.39; 'hello,': 0.40; 'save': 0.60; 'your': 0.60; 'real': 0.62; 'back': 0.62; 'needing': 0.63; 'more': 0.63; 'different': 0.63; 'great': 0.63; 'between': 0.65; 'here': 0.66; 'skip:n 40': 0.72; 'photo': 0.81; 'lying': 0.84; 'ok?': 0.84; 'working,': 0.84; 'period.': 0.95 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; bh=bAzUeyJAEBGRuXq6DHchvFOVkfS9T8kPHD+DCJuk4/g=; b=CL85RQGMa7CLdh5v4ebYDkYMySfJhprnJGoMLkw+9Cu9DOJe03UiGN0CgOV/1VZplU NsSS+NoGeSlZQHxt6RCPhoG7B4Kv29Oiugp9Bk8TH85lJst3k/n1fcZ9vvAUc4mkP8gm TY3m5RgFq3AcXIhuoTY1bmyArASXByGl/lr13CJHAHzlYn8gpn2MCvjL8mKgT/bON05l dlGRt4f5ky8USJMw8wKIw+P6HSQwrrH9MVT+aPlVjVcKOPp2FHbo0iP1/BGS+D5q6hig PNkk1riyYTrG3nKhP2izGBKMziUanb7OL1diWauHhjcazQPHxzHBAzlU+36BB1cdPJmF 30Aw== |
| X-Received | by 10.180.210.162 with SMTP id mv2mr11104511wic.47.1442848867383; Mon, 21 Sep 2015 08:21:07 -0700 (PDT) |
| MIME-Version | 1.0 |
| In-Reply-To | <201509202250.t8KMoC0h009296@fido.openend.se> |
| References | <f1c3720b-ee32-4a22-bdfa-7a1bedebc16f@googlegroups.com> <mailman.42.1442767228.21674.python-list@python.org> <ed98eb8c-8316-41bc-97ff-008c2f0c91f3@googlegroups.com> <201509201812.t8KICXHu004041@fido.openend.se> <CAKSfFmhqTWzem6aW+3KOxKTo4C35JdmoRv=BrkSu8+Hruz3WmA@mail.gmail.com> <201509201909.t8KJ93oU018314@fido.openend.se> <CAKSfFmiThEyW8B=ni8NA1FGY1aC2sU3L1CApgy1oA6A8+MKQvQ@mail.gmail.com> <201509201952.t8KJqh7W029272@fido.openend.se> <CAKSfFmiV7pqRk4f0y28Vq3z-5pQb6Vs+J1TotR4CShKwk5GecQ@mail.gmail.com> <201509202250.t8KMoC0h009296@fido.openend.se> |
| From | Baladjy KICHENASSAMY <baladjy@gmail.com> |
| Date | Mon, 21 Sep 2015 17:20:47 +0200 |
| Subject | Re: Postscript to pdf |
| To | Laura Creighton <lac@openend.se> |
| Cc | python-list@python.org |
| Content-Type | text/plain; charset=UTF-8 |
| Content-Transfer-Encoding | quoted-printable |
| X-Mailman-Approved-At | Tue, 22 Sep 2015 09:20:04 +0200 |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.20+ |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.55.1442906405.28679.python-list@python.org> (permalink) |
| Lines | 243 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1442906405 news.xs4all.nl 23733 [2001:888:2000:d::a6]:47417 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:96973 |
Show key headers only | View raw
Hello,
This is my programe : on mac i was able to output ps file but i didn't
got the pdf file :/
# -*- coding: utf-8 -*-
# script lecture_gif.py
from Tkinter import *
import tkMessageBox
import Tkconstants
import tkFileDialog
from PIL import ImageTk
import PIL.Image
import os, sys
import subprocess
def Ouvrir():
Canevas.delete(ALL) # on efface la zone graphique
filename = tkFileDialog.askopenfilename(title="Ouvrir une
image",filetypes=[('gif files','.gif'),('all files','.*')])
print(filename)
photo = PhotoImage(file=filename)
gifdict[filename] = photo # référence
print(gifdict)
Canevas.create_image(0,0,anchor=NW,image=photo)
Canevas.config(height=photo.height(),width=photo.width())
Mafenetre.title("Image "+str(photo.width())+" x "+str(photo.height()))
def insertimage():
n=tkFileDialog.askopenfilename(filetypes = [("Image Files", ("*.jpg",
"*.gif")),("JPEG",'*.jpg'),("GIF",'*.gif'),('All','*')])
img = PIL.Image.open(n)
img = img.resize((229, 253))
photoimg = ImageTk.PhotoImage(img)
label = Label(image=photoimg)
label.image = photoimg # keep a reference!
Canevas.create_image(65,320,anchor=W,image = photoimg)
def insertsign():
n=tkFileDialog.askopenfilename(filetypes = [("Image Files", ("*.jpg",
"*.gif")),("JPEG",'*.jpg'),("GIF",'*.gif'),('All','*')])
img = PIL.Image.open(n)
img = img.resize((300, 100))
photoimg = ImageTk.PhotoImage(img)
Canevas.create_image(600,500,anchor=W,image = photoimg)
Canvas.pack()
def Fermer():
Canevas.delete(ALL)
Mafenetre.title("Image")
def save():
Canevas.update()
Canevas.postscript(file=tkFileDialog.asksaveasfilename(), colormode='color')
subprocess.call(["ps2pdf", "-dEPSCrop", "test.ps", "test.pdf"])
# def convert():
# ps2pdf -dEPSCrop image.ps
# convert -density 300 PASSPORTQUALITE.ps output.png
# class TkFileDialogExample(Tkinter.Frame):
#
# def __init__(self, root):
#
# Tkinter.Frame.__init__(self, root)
# button_opt = {'fill': Tkconstants.BOTH, 'padx': 5, 'pady': 5}
# Tkinter.Button(self, text='Save',
command=self.asksaveasfilename).pack(**button_opt)
#
# self.file_opt = options = {}
# options['filetypes'] = [('all files', '.*'), ('text files', '.txt')]
# options['initialfile'] = 'myfile.txt'
# options['parent'] = root
#
# def asksaveasfilename(self):
# filename = tkFileDialog.asksaveasfilename(**self.file_opt)
#
# if filename:
# return open(filename, 'w')
#
# if __name__=='__main__':
# root = Tkinter.Tk()
# TkFileDialogExample(root).pack()
# root.mainloop()
def Apropos():
tkMessageBox.showinfo("A propos","Tutorial")
def Write():
def delete():
e1.delete(0,END)
e2.delete(0,END)
e3.delete(0,END)
e4.delete(0,END)
e5.delete(0,END)
e6.delete(0,END)
Canevas.delete("e1")
def valider():
Canevas.create_text(315,200,anchor=W,text="Surname/Nom",fill='Black',font='Arial
14')
Canevas.create_text(315,220,anchor=W,text=e1.get(),fill='Black',font='Arial
30',tags ="e1")
Canevas.create_text(315,250,anchor=W,text="Given
name/Prénom",fill='Black',font='Arial 14')
Canevas.create_text(315,270,anchor=W,text=e2.get(),fill='Black',font='Arial
30',tags ="e1")
Canevas.create_text(315,300,anchor=W,text="Fonction/Function",fill='Black',font='Arial
14')
Canevas.create_text(315,320,anchor=W,text=e3.get(),fill='Black',font='Arial
30',tags ="e1")
Canevas.create_text(470,395,anchor=W,text=e4.get(),fill='Black',font='Arial
30',tags ="e1")
Canevas.create_text(500,438,anchor=W,text=e5.get(),fill='Black',font='Arial
30',tags ="e1")
Canevas.create_text(228,503,anchor=W,text=e6.get(),fill='Black',font='Arial
30',tags ="e1")
master = Tk()
Label(master, text="Surname/Nom").grid(row=0)
Label(master, text="Given name/Prénom").grid(row=1)
Label(master, text="Fonction/Function").grid(row=2)
Label(master, text="Validity Date").grid(row=3)
Label(master, text="Chef").grid(row=4)
Label(master, text="Student number").grid(row=5)
e1 = Entry(master)
e2 = Entry(master)
e3 = Entry(master)
e4 = Entry(master)
e5 = Entry(master)
e6 = Entry(master)
e1.grid(row=0, column=1)
e2.grid(row=1, column=1)
e3.grid(row=2, column=1)
e4.grid(row=3, column=1)
e5.grid(row=4, column=1)
e6.grid(row=5, column=1)
Button(master, text='Ok', command=valider).grid(row=2, column=2,
sticky=W, pady=4)
Button(master, text='Delete', command=delete).grid(row=3, column=2,
sticky=W, pady=4)
mainloop( )
# Main window
Mafenetre = Tk()
Mafenetre.title("Image")
# Création d'un widget Menu
menubar = Menu(Mafenetre)
menufichier = Menu(menubar,tearoff=0)
menufichier.add_command(label="Open mask",command=Ouvrir)
menufichier.add_command(label="Save mask",command=save)
#menufichier.add_command(label="Convert pdf",command=convert)
menufichier.add_command(label="Close mask",command=Fermer)
menufichier.add_command(label="Quit",command=Mafenetre.destroy)
menubar.add_cascade(label="File", menu=menufichier)
menuwrite = Menu(menubar,tearoff=0)
menuwrite.add_command(label="Insert informations",command=Write)
menuwrite.add_command(label="Insert image",command=insertimage)
menuwrite.add_command(label="Insert signature",command=insertsign)
menubar.add_cascade(label="Informations", menu=menuwrite)
menuaide = Menu(menubar,tearoff=0)
menuaide.add_command(label="A propos",command=Apropos)
menubar.add_cascade(label="Aide", menu=menuaide)
# Affichage du menu
Mafenetre.config(menu=menubar)
# Création d'un widget Canvas
Canevas = Canvas(Mafenetre)
Canevas.pack(padx=5,pady=5)
# Utilisation d'un dictionnaire pour conserver une référence
gifdict={}
Mafenetre.mainloop()
2015-09-21 0:50 GMT+02:00 Laura Creighton <lac@openend.se>:
> In a message of Sun, 20 Sep 2015 23:11:20 +0200, Baladjy KICHENASSAMY writes:
>>well one more question :/
>>
>>i tried this
>>
>>def save():
>> Canevas.update()
>> Canevas.postscript(file=tkFileDialog.asksaveasfilename(),
>>colormode='color')
>> subprocess.call(["ps2pdf", "-dEPSCrop", "test.ps", "test.pdf"])
>>
>>
>>i got the ps file but i didn't get the pdf file :/
>
> It's 00:41 here in Sweden, and I have an 08:00 meeting. I am off to bed.
> Perhaps somebody else can help now, otherwise I will be back
> tomorrow.
>
> I've never tried to get subprocess to run as part of a savefile dialog.
> Try building a tkinter app that takes a filename argument (somepostscript
> file you have lying around) and then push the button, in the same dir
> makes a pdf of your ps using subprocess.
>
> If that works, then see about getting save to run that subprocess as
> part of the save process. I am very curious about whether that can
> be done -- but first check that your subprocess is working, period.
> The wretched thing is slightly different between windows and linux,
> and even between different linuxes, so needing to fiddle a bit here is
> normal (and frustrating).
>
> So right now I cannot tell if your problem is 'save doesn't like
> it like that' or 'your subprocess isn't working'.
>
> But nothing in Tkinter likes 'Canevas' -- (which is great French
> but rotten English) you must have written Canvas in your code.
>
> Paste the real thing in next time, ok?
>
> Sorry I am off now,
> Laura
--
KICHENASSAMY Baladjy
Ingénieur en Génie Mécanique
Spécialiste Contrôle Non Destructif et Qualification des procédés spéciaux
COSAC CND Niveau 2 RT et PT
Aircelle SAFRAN
Tel:06.03.72.53.12
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Postscript to pdf Bala Ji <baladjy@gmail.com> - 2015-09-20 09:20 -0700
Re: Postscript to pdf Laura Creighton <lac@openend.se> - 2015-09-20 18:40 +0200
Re: Postscript to pdf Bala Ji <baladjy@gmail.com> - 2015-09-20 09:50 -0700
Re: Postscript to pdf Laura Creighton <lac@openend.se> - 2015-09-20 20:12 +0200
Re: Postscript to pdf Laura Creighton <lac@openend.se> - 2015-09-20 21:09 +0200
Re: Postscript to pdf Baladjy KICHENASSAMY <baladjy@gmail.com> - 2015-09-20 20:27 +0200
Re: Postscript to pdf Christian Gollwitzer <auriocus@gmx.de> - 2015-09-21 15:39 +0200
Re: Postscript to pdf Baladjy KICHENASSAMY <baladjy@gmail.com> - 2015-09-20 21:32 +0200
Re: Postscript to pdf Laura Creighton <lac@openend.se> - 2015-09-20 21:52 +0200
Re: Postscript to pdf Laura Creighton <lac@openend.se> - 2015-09-21 00:50 +0200
Re: Postscript to pdf Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2015-09-20 20:25 -0400
Re: Postscript to pdf Baladjy KICHENASSAMY <baladjy@gmail.com> - 2015-09-20 23:11 +0200
Re: Postscript to pdf Nobody <nobody@nowhere.invalid> - 2015-09-21 13:56 +0100
Re: Postscript to pdf Baladjy KICHENASSAMY <baladjy@gmail.com> - 2015-09-21 17:20 +0200
Re: Postscript to pdf Christian Gollwitzer <auriocus@gmx.de> - 2015-09-23 08:40 +0200
Re: Postscript to pdf mithra <curtis.rendon@gmail.com> - 2015-09-23 17:01 -0700
Re: Postscript to pdf Terry Reedy <tjreedy@udel.edu> - 2015-09-21 00:17 -0400
csiph-web