Path: buffer2.nntp.dca1.giganews.com!buffer1.nntp.dca1.giganews.com!news.giganews.com.POSTED!not-for-mail NNTP-Posting-Date: Sun, 27 Feb 2022 07:23:33 -0600 Newsgroups: fr.comp.lang.python Subject: Re: win32api pas python 3.10.2 essais startfile X-poster: PEAR::Net_NNTP v1.5.0 (stable) From: kirob17 References: <2v-dnVwhge4R0of_nZ2dnUU7_8zNnZ2d@giganews.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit Organization: !No_Organization! Message-ID: <44qdnZLtRtPI5ob_nZ2dnUU7_8zNnZ2d@giganews.com> Date: Sun, 27 Feb 2022 07:23:33 -0600 Lines: 49 X-Usenet-Provider: http://www.giganews.com X-Trace: sv3-PYPHnv2tHoREUCHOopWxWh9mbxSsR/Zyxw9SByBSPyaGbow7A/63p/N11J3ZsD1Kee0DqHA7HFEFn2o!LYW71nRHrM27Xz7RTfI51HHdMbW3Pn0+Mc5Rm6oz2oHE0K3AA4wB6XyTH+6Y5k8ZDu2Y95gs6cTo X-Complaints-To: abuse@giganews.com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.40 Bytes: 2487 Le samedi 26 Février 2022 à 17:04 par kirob17 : > Bonjour, > je joint mon script : > -------------------------- > # -*- coding : utf-8 -*- > # Python 3.10.2 > from tkinter import * > from os import startfile > from tkinter import filedialog > import tkinter as tk > > root = Tk() > > root.title('Imprimer des copies papier') > root.geometry("350x150") > > def print_file(): > file_to_print = filedialog.askopenfilename( > initialdir="/", title="Select file", > filetypes=(("Text files", "*.txt"), ("all > files", "*.*"))) > > if file_to_print: > startfile.ShellExecute(0, "print", file_to_print, None, > ".", 0) > > > Button(root, text="Imprimer le fichier", command=print_file).pack() > > button = tk.Button(text = "Click et Quitter", command = root.quit) > button.pack(side=BOTTOM) > > root.mainloop() > ---------------------------- > pouvez-vous m'aider a résoudre mon problème. > merci d'avance > cordialement > kyrob17 bonjour, le problème se résulte a cette ligne : ("startfile.ShellExecute(0, "print", file_to_print, None, ".", 0) ") tous le script se déroule bien choix des fichiers txt mais n'imprime pas. je doit avouer que je me suis mis au python depuis deux mois. je ne peut pas installer win32api la version du python que j' est le 3.10.2 merci, cordialement kyrob17