Python Forum

Full Version: Initializing a PRINTDLG structure-how to
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I am trying to find documentation (in python) on how to initialize windows PRINTDLG and pass the structure to PrintDlg.
Thanks for any help.
Not a Windows user here, but obviously it exists somewhere in Mark Hammond's pywin32 module.
What GUI are you using? QT has some nice printer dialog management tools...
I am using Kivy as a GUI. In the app i am running/displaying some data table sorts. As an afterthought I wanted to give the user the ability to print out their search so I save data in a text file and have a simple print command for either a Linux or WIn platform to print out.

def print_to_screen(self,instance):
try:
if platform=='linux':
os.system('lp -o media=letter -o fit-to-page -o landscape search.txt')
if platform=='win':
os.startfile("search.txt", "print")

The command for Linux is satisfactory for now however in Windows I need to either fit-to-page or change to landscape. I am inexperienced in printing and have not found a way on the windows os print command to add the landscape requirement.
Being inexperienced, I thought the Windows system already had a Print Dialogue and Page Setup Dialogue that I could just call from my app and feed it my text file and the user could modify as needed vs. using above.

So for now if I could just get above to print in landscape I could get by.
Printing looks like it can get involved.
Thanks to all.
Sorry, found answers in wxPython and PyQt but not Kivy. Perhaps someone else...