• Re: is possible to insert image in wish or graphic console?

    From Rich@21:1/5 to [email protected] on Tue Jan 16 20:52:15 2024
    pd <[email protected]> wrote:
    Is there any way to insert an image in wish or any other graphic
    console?

    Provided said 'graphic consoles' are based off the Tk text widget, then
    yes, as the text widget already supports inserting and display of Tk
    images.

    So you'd need to modify the console to include a display command to
    display an image.

    Doing "puts [image data]" would just get you the text encoded image
    data, so better to have something like:

    display image

    Where 'display' is built in to the console and includes the small
    amount of code to insert the image named 'image' into the next line of
    the console text widget.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Rich@21:1/5 to [email protected] on Tue Jan 16 21:47:04 2024
    pd <[email protected]> wrote:
    El martes, 16 de enero de 2024 a las 21:52:20 UTC+1, Rich escribió:
    pd <[email protected]> wrote:
    Is there any way to insert an image in wish or any other graphic
    console?
    Provided said 'graphic consoles' are based off the Tk text widget, then
    yes, as the text widget already supports inserting and display of Tk
    images.

    Ok, and how can I get the "widget" associated with the graphic
    console? for example, if I run tkcon and try to get the window name
    with:

    winfo name .

    On that I suggest you look into how the console is implemented. Tkcon
    is just a Tcl/Tk script. I've not gone looking because I do my Tk
    programming on Linux, where I already have a proper, real, console (xterm/rxvt/urxvt/etc.) and so I seldome ever use Tkcon. And the few
    times I do it is only to connect to a running Tk instance for a quick inspection.

    I get a message saying Tk is not loaded and asking me to retry the
    command after loading Tk, doing so a new Tk main window named "tkcon"
    appears and now tk commands refer to that window, not to the window
    of Tkcon console itself.

    Tkcon's probably running the console in an interpreter separate from
    the one that handles Tkcon's own windows. Again, inspect the Tkcon
    source, it is all just Tcl.

    So assuming wish console is a Tk window itself, how can I get its
    widgets and send tk commands to them?

    Also, unsure. Look for the Tcl script that is lauched to make that
    console and inspect how it is built to do its job. It is probably
    running in a separate interpreter, so you'd need to find out the name
    and then send commands into that interpreter.

    If wish console is a graphic program but not a tk program, then I
    suppose I have to use graphic API beneath (windows, gtk...) to
    provide access to wish painting area and provide commands to interact
    with it like the one you suggest to diplay an image.

    Tkcon is just a Tcl/Tk script. I believe the basic 'console' that is
    provided for windows builds is just a Tcl/Tk script as well. Dig into
    the files installed for Tcl/Tk and see what you find.

    A maybe better alternative is to program a console in Tk itself,

    I.e., just what Tkcon is, and what the basic console is as well (I
    believe).

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From et99@21:1/5 to All on Tue Jan 16 14:44:10 2024
    On 1/16/2024 12:36 PM, pd wrote:
    Is there any way to insert an image in wish or any other graphic console?

    I assume wish is a window program ie a graphic one, at least this seems to be true in the case of windows OS, like is said in tk docs:

    "Note that on Windows, the wishversion.exe program varies from the tclshversion.exe program in an additional important way: it does not connect to a standard Windows console and is instead a windowed program. Because of this, it additionally provides
    access to its own console command."
    https://www.tcl.tk/man/tcl/UserCmd/wish.html

    So, it should be possible to write an image to the main window of wish and get displayed in the wish window.

    For example, it would be cool if you can write code like this:

    % image create photo -file "anImage.png"
    image1
    % puts [image1 data]

    and you get below the last line the image displayed in the wish console in similar way that it works in racket repl or smalltalk transcript window or factor listener.



    In tcl/tk 8.7 and 9.0 both toplevel and frames can include background images (TIP 262). For demo code, see here:

    https://wiki.tcl-lang.org/page/backgroundimage

    One thing this can do is allow "skins", perhaps along with using the the place geom manager.

    The windows console can be tweaked using the console eval command to add images. See

    https://wiki.tcl-lang.org/page/console

    and open the first discussion. Also, you can get a linux console if you use the code in

    https://wiki.tcl-lang.org/page/console+for+Unix

    I have added a few images to my consoles just for fun, for a few fancy buttons.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Christian Gollwitzer@21:1/5 to All on Wed Jan 17 09:21:33 2024
    Am 16.01.24 um 21:36 schrieb pd:
    Is there any way to insert an image in wish or any other graphic console?

    If you use tkcon, which is much better than the built-in console
    anyway, it is right here in the front page of it:

    https://wiki.tcl-lang.org/page/Tkcon


    Christian

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From et99@21:1/5 to All on Wed Jan 17 20:33:38 2024
    On 1/17/2024 8:04 AM, pd wrote:
    El martes, 16 de enero de 2024 a las 23:44:17 UTC+1, et99 escribió:
    On 1/16/2024 12:36 PM, pd wrote:
    Is there any way to insert an image in wish or any other graphic console?

    https://wiki.tcl-lang.org/page/backgro
    https://wiki.tcl-lang.org/page/console
    https://wiki.tcl-lang.org/page/console+for+Unix

    interesting links, specially the info about console

    The windows console can be tweaked using the console eval command to add images. See

    yes, reading your links and the one by C.Gollwitzer and tkcon source I realized tkcon provides an api with several commands, in particular it provides tkcon console to access to the text widget... it would be easier simply to extend this api with the
    commands you like

    I use the built in console to be certain I have somewhere to output a message log. No package require, no sourcing, etc. Even androwish has a console. Only unix is left out, but in under 200 lines of code, which I just include in my own programs, I can
    be sure of having a console everywhere my programs will run. Tkcon is 6500 lines, and it's not always available. I think of it more as a debugger than a simple console.

    I suspect your needs are different and so tkcon may very well be the ticket for you.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)