Canvas Probs -please help 
Author Message
 Canvas Probs -please help

Hello!
I have got a graet question concerning canvas and TK. Th eproblem is, that I cant get
any canvas (or canvasses) to work.
I try the examples of Mr,. Welshs Book, but nothing happens.
Is it impossible to start those canvas scripts directly or what do i do wrong?

heres an example that dioes not work. It is the canvasHello.tcl

#!/usr/local/bin/wish -f
# Canvas chapter
proc Init {} {
        # Create and pack the canvas
        canvas .c -width 400 -height 100
        pack .c
        # Create a text object on the canvas
        .c create text 50 50 -text "Hello, World!" -tag movable
        # Bind actions to the text object
        .c bind movable <Button-1> {Mark %x %y %W}
        .c bind movable <B1-Motion> {Drag %x %y %W}

Quote:
}

proc Mark { x y w } {
        global state
        set state($w,obj) [$w find closest $x $y]
        set state($w,x) $x
        set state($w,y) $y
Quote:
}

proc Drag { x y w } {
        global state
        set dx [expr $x - $state($w,x)]
        set dy [expr $y - $state($w,y)]
        $w move $state($w,obj) $dx $dy
        set state($w,x) $x
        set state($w,y) $y    

Quote:
}

I just added the first line to make sure that wish gets executed to execute
that script.

But nothing happens. I only get the wish window, but this time its called canvasHello.tcl.
Otherwise, nothing happens.

Please help me!

Would be nice if you could

Thanx in advance,

Joerg Dahmen, UT Aachen, Germany
--
    _
   //    A1200/68030-50Mhz/CDROM/Harddisk - and I am not alone...
  //               Project Manager 'Fortress of Fear'
\x/     - When all hope has gone only the faithful will survive -



Tue, 18 May 1999 03:00:00 GMT  
 Canvas Probs -please help

Quote:

> #!/usr/local/bin/wish -f
> # Canvas chapter
> proc Init {} {
>         # Create and pack the canvas
> }

> proc Mark { x y w } {
>         global state
> }
> proc Drag { x y w } {
>         global state
> }

> I just added the first line to make sure that wish gets executed to execute
> that script.

All I see here is a few proc definitions.  Is there part of the file
that you
aren't posting.  such as the line:

Init

--



Wed, 19 May 1999 03:00:00 GMT  
 Canvas Probs -please help

In the example you provided, your code defined 3 functions.  However,
you did not show any code actually invoking those functions.

Was part of your posting truncated?
--

:s <URL:http://www.teraform.com/%7Elvirden/> <*> O- "We are all Kosh."
:s Unless explicitly stated to the contrary, nothing in this posting should
:s be construed as representing my employer's opinions.



Fri, 21 May 1999 03:00:00 GMT  
 Canvas Probs -please help

Hello!
I just wanted to thank everybody who answered my question to the topic
above. Now I know it was a rather stupid question, but i thought that
Init would be some kind of main program in Tcl-tk.
But as my old teachers used to say, there is no stupid question! :-)

Well thank you very much and look out for other questions to be put by me...
:-)

Yours sincerely,

Joerg Dahmen, UT Aachen, Germany
--
    _
   //    A1200/68030-50Mhz/CDROM/Harddisk - and I am not alone...
  //               Project Manager 'Fortress of Fear'
\x/     - When all hope has gone only the faithful will survive -



Sun, 23 May 1999 03:00:00 GMT  
 Canvas Probs -please help

Hai Joerg

d> #!/usr/local/bin/wish -f
d> # Canvas chapter
d> proc Init {} {
d>   # Create and pack the canvas
d>   canvas .c -width 400 -height 100
d>   pack .c
d>   # Create a text object on the canvas
d>   .c create text 50 50 -text "Hello, World!" -tag movable
d>   # Bind actions to the text object
d>   .c bind movable <Button-1> {Mark %x %y %W}
d>   .c bind movable <B1-Motion> {Drag %x %y %W}
d> }
d>
d> proc Mark { x y w } {
d>   global state
d>   set state($w,obj) [$w find closest $x $y]
d>   set state($w,x) $x
d>   set state($w,y) $y
d> }
d> proc Drag { x y w } {
d>   global state
d>   set dx [expr $x - $state($w,x)]
d>   set dy [expr $y - $state($w,y)]
d>   $w move $state($w,obj) $dx $dy
d>   set state($w,x) $x
d>   set state($w,y) $y
d> }
d>
# Try this line:
Init

How should a procedure work, when you dont call it?

  Michael

!! ACHTUNG !!



Wed, 26 May 1999 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. probs with LAmbda calulus need help please

2. Please help -> probs creating array

3. please, please, please, please, help

4. will someone please, please, please, please HELP me?!!

5. Need help with canvas widget in Tkinter please

6. Please help, any info will be greatly received - re: Invisible Canvas

7. Tkinter/Canvas question, Please Help

8. Exporting Canvases as pictures?? Please Help

9. Canvases and movable tag - please help

10. VSE 3.1 Repository Problem: Please help (please please?)

11. PLEASE PLEASE PLEASE HELP !!!!!!!!!!!!

12. please,please please do help us

 

 
Powered by phpBB® Forum Software