How to print with PYGTK on quickly

Posted by user88476 on Ask Ubuntu See other posts from Ask Ubuntu or by user88476
Published on 2012-09-30T12:07:05Z Indexed on 2012/11/11 11:28 UTC
Read the original article Hit count: 221

I am trying to make a program that can open save and print texts with Quickly, but I can't get the printing part to work.

In my code when you press the "printbutton" it opens a print dialog:

def on_printbutton_clicked(self,widget):
    self.printdialog.show()

and that works fine. And when you click "ok" it will gather the settings from the dialog and try to print:

def on_printdialog_response(self,widget,ok):
    printjob = gtkunixprint.PrintJob(self.filename,self.printdialog.get_selected_printer,self.printdialog.get_setting,self.printdialog.get_page_setup)

but when I run it doesn't work and just gives me this:

NameError: global name 'gtkunixprint' is not defined

Is "gtkunixprint" wrong? Or is it something else in my code? Or should I first import something?

I hope you can help me.

© Ask Ubuntu or respective owner

Related posts about application-development

Related posts about printing