Jump to content
Sign in to follow this  
diogo2009

Duvida Tkinter + win32print

Recommended Posts

diogo2009

Bom eu estou tentando fazer um editor de textos só para aprender a usar

melhor as ferramentas do módulo Tkinter.

Para implementar a função de impressão eu utilizei o modulo win32print

mas a função não funciona às vezes

O código da função é esse

def Imprim(self,event=None):
                try:
                        self.tex_to_print = self.editor.get("1.0",END)
                        self.I_padrao = win32print.GetDefaultPrinter()
                        self.Open_I = win32print.OpenPrinter(self.I_padrao)

                        self.b =  (str(self.tex_to_print)) 


                        win32print.StartDocPrinter(self.Open_I,1,("",None,None))
                        win32print.WritePrinter(self.Open_I,self.b+'\f')
                        win32print.EndDocPrinter(self.Open_I)
                        win32print.ClosePrinter(self.Open_I)
                except:
                        pass

Bom, se alguém puder me ajudar fico muito agradecido.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.