1
votes

I want to convert data from MySQL to HTML by using TCL.

  1. The real problem converting mysql data to html,
  2. showing that html in TCL viewer,
  3. can I host IE inside TCL canvas or some widget anything etc. I want to develop adhoc HTML-reporting module for an assignment.

In short: I want to load/open/view HTML file in TCL. Any samples would be highly appreciated.

2
Can you just open the HTML in the web browser? - Hai Vu
If that was the case, I wouldn't have asked this question. - Anonymous

2 Answers

1
votes

While you can't just make IE render on a canvas — too many things interact in unpleasant ways to make that impossible — you may well be able to use OpTcl to embed it in a window, which you can then put in a canvas if you choose.

Here's the informative example from that page:

package require optcl

optcl::new -window .htm {http://wiki.tcl.tk}
.htm config -width 800 -height 600
pack .htm

This will manufacture an instance of the COM object for handling an HTTP URL (in this case, http://wiki.tcl.tk) and embed it in a Tk widget (.htm). If you were going to embed it in a canvas, you'd do:

package require optcl
canvas .canv
optcl::new -window .canv.htm http://wiki.tcl.tk
.canv create window 0 0 -anchor nw -window .canv.htm
pack .canv

Well, that's the minimum. You'd really do a bit more (adding scrollbars, etc.)

There's a more extensive example on the Wiki too. (This doesn't appear to be a task for Tcom; that's designed to allow Tcl to interact with COM, but not really to allow Tk to embed widgets defined by it.) Be aware that I've not tested this on recent Windows systems or with recent versions of Tcl/Tk.

0
votes

I want to convert data from MySQL to HTML by using TCL.

With data from a table, you may be better off using the TkTable widget, sidestepping the conversion to HTML entirely.

I want to load/open/view HTML file in TCL.

There is a Tk-widget called TkHTML, which seems like it'll do just what you need.