Cannot press OK in Windows Print Dialog / How can i print in Windows ?

mzo hilfmir at gmx.at
Tue Jan 13 17:55:59 CET 2004


Hello 
I want to use the Standard Windows Common Dialog, because i want a
orginal Windows Look and Feel in a pyGTK - GUI.

I use Python 2.3 with PythonWin GUI Extension and Win32 Extension. 

ColorSelectionDialog, FileSelectionDialog, FontSelectionDialog work
well, but
PrintDialog do not work. 

I have made a small example: 
-----------------------------
import win32ui
import gtk

dllhandle = win32ui.LoadLibrary("C:\\WINNT\\SYSTEM32\\COMDLG32.DLL")

pcd = win32ui.CreatePrintDialog(1538, gtk.FALSE,
win32ui.PD_NOPAGENUMS|win32ui.PD_PAGENUMS|win32ui.PD_SELECTION|win32ui.PD_SHOWHELP|win32ui.PD_PRINTTOFILE|win32ui.PD_ALLPAGES,
None, dllhandle )

res = pcd.DoModal()
-----------------------------

This Example load the Print Dialog/ Print Setup but if i press OK
nothing do (The dialog do not close, like expected). I can the Window
only close with Cancel and get "2" back.
Whats´s wrong ? 
How can i get the Settings and print with this settings after the
dialog ?


A not so important question is, how i can connect a Help-message to
the Help button in the Print Dialog ?



The Pythonwin-Printdialog  (from pywin.mfc import dialog) use the
CreatePrintDialog but i do not know whats pinfo.
Where can i get pinfo (need to call this function). 


The Head of PrintDialog is: 
-----------------------------------------
class PrintDialog(Dialog):
	" Base class for a print dialog"
	def __init__(self, pInfo, dlgID,
                     printSetupOnly = 0,
                     flags=(win32ui.PD_ALLPAGES|
                            win32ui.PD_USEDEVMODECOPIES|
                            win32ui.PD_NOPAGENUMS|
                            win32ui.PD_HIDEPRINTTOFILE|
                            win32ui.PD_NOSELECTION),
                     parent=None,
                     dllid=None):
-------------------------------




Thanks 
martin



More information about the Python-list mailing list