Tcl/Tk printing on Windows 95/98 
Author Message
 Tcl/Tk printing on Windows 95/98

Hi All,
How to print a content of a Tk listbox or a text window
to a printer  (LPT1) ?
Thanks in advance.
Chin Pham




Thu, 15 Nov 2001 03:00:00 GMT  
 Tcl/Tk printing on Windows 95/98


Quote:
> Hi All,
> How to print a content of a Tk listbox or a text window
> to a printer  (LPT1) ?
> Thanks in advance.
> Chin Pham

Chin:

If you plan on doing much printing, you will need to get
the printer and gdi packages and install them.  I think
I got them off of the neosoft archive.  They are included
on the TCL Blast CDROM available from Scriptics.  If you
plan on doing much programming w/Tcl/TK, this is something
you should get.

The following may be of help:
-------------------------------------------------
text .text
pack .text

proc file_print { } {
        set pdata [.text get 1.0 end]
        set fileid [open lpt1 {WRONLY}]
        puts $fileid $pdata
        close $fileid

Quote:
}

button .q -text "Quit" -command {exit}
button .pr -text "Print" -command {file_print}
pack .q -side right
pack .pr -side left
---------------------------------------------------

Please note, this will print 'raw' data to the printer,
and I didn't take the time to add any formatting or
form feed (you will have to eject paper manually).

Printing from a listbox becomes more complicated, also
do you want to print the whole list, or just the current
selection?

I will hack something out if I get a chance in the next
few days.

Hope this helps.

Steve
--
Steve Offutt Industrial Mold & Tool Co
"The only person that makes no mistakes
is the one who does nothing at all"
:-)

Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.



Sun, 18 Nov 2001 03:00:00 GMT  
 Tcl/Tk printing on Windows 95/98


Quote:


>> Hi All,
>> How to print a content of a Tk listbox or a text window
>> to a printer  (LPT1) ?
>> Thanks in advance.
>> Chin Pham
>Chin:

>If you plan on doing much printing, you will need to get
>the printer and gdi packages and install them.  I think
>I got them off of the neosoft archive.  They are included
>on the TCL Blast CDROM available from Scriptics.  If you
>plan on doing much programming w/Tcl/TK, this is something
>you should get.

>Steve

Thanks for mentioning the printer and gdi packages. Their home is
http://www.du.edu/~mschwart/tcl-tk.htm
Recently, John Blattner contributed a proc to print a canvas; I believe this could be extended
easily to include printing a text widget.

The use of GDI, in particular, makes the print independent of port and printer.

Michael

--
Michael Schwartz                  "Expect everything...
                                        and the unexpected never happens"



Mon, 19 Nov 2001 03:00:00 GMT  
 Tcl/Tk printing on Windows 95/98
There is no easy way. You can only print canvases in graphics mode using
postscript.
All the rest you have to "make up" yourself. This is still one of the
weak points of

Tcl/Tk.In general, you open "lpt1" on your machine and write to it using
puts. The
encoding suitable for your printer you have to handle yourself. You
could also
access the Windows GDI which is not trivial either.

Holger

Chin Pham schrieb:

Quote:
> Hi All,
> How to print a content of a Tk listbox or a text window
> to a printer  (LPT1) ?
> Thanks in advance.
> Chin Pham





Mon, 19 Nov 2001 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Printing on Windows 95/NT from Tcl/TK?

2. Printing from Windows 95 TCL/TK

3. Clarion 2.1 and Printing on Win 95 / 98

4. Tcl/Tk '98: 6th USENIX Tcl/Tk Conference

5. Tcl/Tk for Windows NT and Windows 95

6. Install Clipper 5.3 at Windows'95/98

7. Mouse doesn't work with Windows 95/98

8. Clipper Debugger Fails In Windows 95 or 98 DOS Box

9. clipper 5.2 and windows 98/95

10. how to Cut and paste with clipper to windows 95 or 98

11. Clipper development for Windows 95, 98 & NT

12. Writing Windows 95/98 applications in Clipper

 

 
Powered by phpBB® Forum Software