Im using Python 2.3.3/wxPython 2.4.2.4 on WindowsXP. I have installed a
Epson TM-300PD receipt printer driver
and if I use MS WORD I can configure and print to the printer. However, when
I attempt to configure the printer
in my wxPython application I get the following error message:
Traceback (most recent call last):
File "D:\Restaurant\Code\wxFrame1.py", line 217, in
OnMnufilePrintSetupMenu
self.printer.PageSetup()
File "C:\Python23\lib\site-packages\wxPython\html.py", line 747, in
PageSetup
val = htmlc.wxHtmlEasyPrinting_PageSetup(self, *_args, **_kwargs)
wxPython.wxc.wxPyAssertionError: C++ assertion "wxAssertFailure" failed in
e:\Projects\wx2.4\src\common\cmndata.cpp(651): Couldn't find paper size in
paper database.
If I execute just the print option in the menu a print setup dialog box
appears and just depressing OK will send my text to the printer. Except that
margins are set to 1.25inches and my paper is 2.99 inches so I get only
about ½ inch of text printed in the center. This isnt good :-(. Is this a
bug in wxPython or is it a receipt printer driver problem. I can setup my HP
laserJet and print without getting this error. But, since this is a POS
type application I need to receipt printer to work. Is there anyone that can
respond to this?
I’m using Python 2.3.3/wxPython 2.4.2.4 on WindowsXP. I have installed a
Epson TM-300PD receipt printer driver
and if I use MS WORD I can configure and print to the printer. However, when
I attempt to configure the printer
in my wxPython application I get the following error message:
Traceback (most recent call last):
File "D:\Restaurant\Code\wxFrame1.py", line 217, in
OnMnufilePrintSetupMenu
self.printer.PageSetup()
File "C:\Python23\lib\site-packages\wxPython\html.py", line 747, in
PageSetup
val = htmlc.wxHtmlEasyPrinting_PageSetup(self, *_args, **_kwargs)
wxPython.wxc.wxPyAssertionError: C++ assertion "wxAssertFailure" failed in
e:\Projects\wx2.4\src\common\cmndata.cpp(651): Couldn't find paper size in
paper database.
It looks like it is trying to map the page size reported by the driver into a wxPaperType so it can select the name of the paper in the dialog, but it is not finding a match for the (non-standard?) paper size used by the receipt printer.
If I execute just the print option in the menu a print setup dialog box
appears and just depressing OK will send my text to the printer. Except that
margins are set to 1.25inches and my paper is 2.99 inches so I get only
about ½ inch of text printed in the center. This isn’t good :-(. Is this a
bug in wxPython or is it a receipt printer driver problem.
wxWidgets allows you to add paper types to the internal list that it has (the "paper database") but unfortunatly wxPython does not wrap those classes. (I didn't even know about them until today!) So instead I think I would just bypass the PageSetup dialog, since it is able to print without it, but set the page setup parameters yourself to get the kind of margins and etc. that you need. You can use wxHtmlEasyPrinting.GetPageSetupData to get a reference to the wxPageSetupDialogData that will be used, and then just call it's SetXXX methods as needed.
···
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!
Thanks for responding so quickly. Unfortunately, bypassing the PageSetup
dialog is not
an option. It will allow me to continue development but it isn't a solution.
The reason is that
on my desktop the receipt is connected to the parallel port an it is the
only printer connected.
Printing is working only because the receipt printer can accept standard
print commands for
text. Any other commands (escape seq. etc) would be hit or miss depending
on whether the
print recognizes it. Also, I need to be able to let the user select the type
of printer the user
wishes to use. An multiple devices can be attached to the parallel port. The
user may also
have a shared printer on a network or USB port. Therefore, the printer name
is needed.
This is where the problem arises. I spent the time to create a widget that
would display the
printer configuration information. I pass the wxPageSetupDialogData to the
widget when
I select the print command. I can print the receipt printer only when a
printer name is NOT
selected. As soon as I select a printer name is when I get the exception
error. As I said
previously I am printer only by chance because it is the only printer
attached to the
parallel port.
Also, when the Receipt printer name is selected I can only change the
Printer ID and margins.
The print size is always (0, 0) regardless of what ID I use.
Is there things else that I should try?
Thanks,
Frank Lynch
email: flynch27@comcast.net
···
-----Original Message-----
From: Robin Dunn [mailto:robin@alldunn.com]
Sent: Monday, April 05, 2004 7:00 PM
To: wxPython-users@lists.wxwidgets.org
Subject: Re: [wxPython-users] Printer problems!
flynch27@comcast.net wrote:
Hi,
I'm using Python 2.3.3/wxPython 2.4.2.4 on WindowsXP. I have installed a
Epson TM-300PD receipt printer driver
and if I use MS WORD I can configure and print to the printer. However,
when
I attempt to configure the printer
in my wxPython application I get the following error message:
Traceback (most recent call last):
File "D:\Restaurant\Code\wxFrame1.py", line 217, in
OnMnufilePrintSetupMenu
self.printer.PageSetup()
File "C:\Python23\lib\site-packages\wxPython\html.py", line 747, in
PageSetup
val = htmlc.wxHtmlEasyPrinting_PageSetup(self, *_args, **_kwargs)
wxPython.wxc.wxPyAssertionError: C++ assertion "wxAssertFailure" failed in
e:\Projects\wx2.4\src\common\cmndata.cpp(651): Couldn't find paper size in
paper database.
It looks like it is trying to map the page size reported by the driver
into a wxPaperType so it can select the name of the paper in the dialog,
but it is not finding a match for the (non-standard?) paper size used by
the receipt printer.
If I execute just the print option in the menu a print setup dialog box
appears and just depressing OK will send my text to the printer. Except
that
margins are set to 1.25inches and my paper is 2.99 inches so I get only
about 1/2 inch of text printed in the center. This isn't good :-(. Is this
a
bug in wxPython or is it a receipt printer driver problem.
wxWidgets allows you to add paper types to the internal list that it has
(the "paper database") but unfortunatly wxPython does not wrap those
classes. (I didn't even know about them until today!) So instead I
think I would just bypass the PageSetup dialog, since it is able to
print without it, but set the page setup parameters yourself to get the
kind of margins and etc. that you need. You can use
wxHtmlEasyPrinting.GetPageSetupData to get a reference to the
wxPageSetupDialogData that will be used, and then just call it's SetXXX
methods as needed.
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!
---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org
Can you tell me if support, to add new printer sizes, to the paper database
will be implemented at some point?
A method to fetch a non-conflicting printer ID and a method to add to the
paper database accepting the
new ID and new paper size would be needed.
What I meant to say about parallel ports was that there could be more than
one parallel port with a printer
attached not multiple devices attached to one parallel port. Sorry I for any
confusion.
Thank again,
Frank Lynch
email: flynch27@comcast.net
···
-----Original Message-----
From: Robin Dunn [mailto:robin@alldunn.com]
Sent: Tuesday, April 06, 2004 10:16 PM
To: wxPython-users@lists.wxwidgets.org
Subject: Re: [wxPython-users] Printer problems!
flynch27@comcast.net wrote:
Is there things else that I should try?
Please ask about it on wx-users. There are folks there with more
in-depth experience with the Print framework than I.
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!
---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org
Can you tell me if support, to add new printer sizes, to the paper database
will be implemented at some point?
A method to fetch a non-conflicting printer ID and a method to add to the
paper database accepting the
new ID and new paper size would be needed.
I've put it on my ToDo list. Whatever classes/functionality are there
for wxWidgets will get wrapped for Python.
···
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!