SmallProgram
Programmer
Hello Friends,
I have some serious Problem.
Iam sending the code.
please check the code and suggest me the solution for this Problem.
Ihave acanvas where Iam setting the scrollregion as given in the canvas.
In the canvas The mouse Event of B1 and Buttonrelease are bound.
We can draw a line with the help of these bindings. The problem is that Once I scroll down the canvas and want to draw the line there Iam not able to get the line at the position I wanted the line to be.
Can u sugget me any answer how to get the line at the place Iam pressing the Button and leaving the Mouse Button.
Thanks In Advance .
Please set the Tab settings In your Machine.
The code reads as
wm withdraw .
toplevel .dialog
canvas .dialog.c -height 900c -width 800c -yscrollcommand {.dialog.sb set} -background white -scrollregion {0c 0c 100c 100c}
scrollbar .dialog.sb -orient vertical -command {.dialog.c yview}
button .dialog.close -text "Close window" -command {wm withdraw .dialog
}
grid .dialog.c -row 0 -column 0 -sticky nsew -pady 4 -padx 2
grid .dialog.sb -row 0 -column 1 -sticky ns -pady 4 -padx 2
grid .dialog.close -row 1 -column 0 -columnspan 2 -pady 2
grid columnconfigure .dialog 0 -weight 1
grid rowconfigure .dialog 0 -weight 1
global X1 Y1
bind .dialog.c <Button-1> {set X1 %x;set Y1 %y;}
bind .dialog.c <ButtonRelease-1> {
.dialog.c create line $X1 $Y1 %x %y -fill red
}
Programmer,Amatuer
I have some serious Problem.
Iam sending the code.
please check the code and suggest me the solution for this Problem.
Ihave acanvas where Iam setting the scrollregion as given in the canvas.
In the canvas The mouse Event of B1 and Buttonrelease are bound.
We can draw a line with the help of these bindings. The problem is that Once I scroll down the canvas and want to draw the line there Iam not able to get the line at the position I wanted the line to be.
Can u sugget me any answer how to get the line at the place Iam pressing the Button and leaving the Mouse Button.
Thanks In Advance .
Please set the Tab settings In your Machine.
The code reads as
wm withdraw .
toplevel .dialog
canvas .dialog.c -height 900c -width 800c -yscrollcommand {.dialog.sb set} -background white -scrollregion {0c 0c 100c 100c}
scrollbar .dialog.sb -orient vertical -command {.dialog.c yview}
button .dialog.close -text "Close window" -command {wm withdraw .dialog
}
grid .dialog.c -row 0 -column 0 -sticky nsew -pady 4 -padx 2
grid .dialog.sb -row 0 -column 1 -sticky ns -pady 4 -padx 2
grid .dialog.close -row 1 -column 0 -columnspan 2 -pady 2
grid columnconfigure .dialog 0 -weight 1
grid rowconfigure .dialog 0 -weight 1
global X1 Y1
bind .dialog.c <Button-1> {set X1 %x;set Y1 %y;}
bind .dialog.c <ButtonRelease-1> {
.dialog.c create line $X1 $Y1 %x %y -fill red
}
Programmer,Amatuer