Re: I cant run this tcl example! What is wrong with it?



On 26 mrt, 11:44, Ahmad <ahmad.abdulgh...@xxxxxxxxx> wrote:
On Mar 26, 12:23 pm, Arjen Markus <arjen.mar...@xxxxxxxxxx> wrote:





On 26 mrt, 11:05, Ahmad <ahmad.abdulgh...@xxxxxxxxx> wrote:

Hi,

I was looking for tabbednotebook sample code, and i had found this
peice of code:

## The original code is got from:
#####  http://incrtcl.sourceforge.net/iwidgets/iwidgets/tabnotebook.html

wm title . "Tabnotebook Example"

##=========================================================
##      Create a tabnotebook iwidget
##=========================================================
##
iwidgets::tabnotebook .tn \
        -tabpos n \
        -width 350 \
        -height 250 \
        -angle 0 \
        -background #336699 \
        -tabbackground white \
        -foreground white \
        -bevelamount 4 \
        -gap 3 \
        -margin 6 \
        -tabborders 0 \
        -backdrop #666666

##
##      Add some tabs
##
foreach t {one two three four} {

        set tb($t) [.tn add -label "Tab [string totitle $t]"]
        frame $tb($t).f \
                -bd 2

        label $tb($t).f.l \
                -text "This is tab $t" \
                -background #336699 \
                -foreground white \
                -font {Helvetica 16 bold}

        pack $tb($t).f.l $tb($t).f \
                -expand 1 \
                -fill both

}

pack .tn

.tn delete 1

##
##      select the second tab (zero based)
##
.tn select 1

####################################################
How can i run this code to see tabs in GUI? What are extra line(s)
needed to be added to the code to be able to run it?

Thanks in advance and best regards,
Ahmad

You will at least need an Itk-enabled "wish" for this,
unless you do in an ordinary wish:

package require Itk
source the-above-code

But it would be more helpful if you post the actual
error message too: there might be something else
going wrong that is not immediately clear.

Regards,

Arjen

Thanks Arjen, The error message is:
invalid command name "wm"
    while executing
"wm title . "Tabnotebook Example""
    (file "test.tcl" line 1)

And BTW, when i tested: package require Itk, it reports that this
package couldn't be found!  So what do you suggest?

Thanks and best regards,
Ahmad- Tekst uit oorspronkelijk bericht niet weergeven -

- Tekst uit oorspronkelijk bericht weergeven -

As Uwe suggests, you need to change "Itk" to "Iwidgets"
and if "wm" is missing, that means you are not running
a shell with Tk inside.

Try using "wish" instead of "tclsh"

Regards,

Arjen
.



Relevant Pages