Relógio analógico
Publicado por Mauricio 08/09/2003
[ Hits: 9.941 ]
Homepage: http://www.mbmaciel.com
Um relógio analógico que não usa gif
#!/bin/sh
# \
exec wish "$0" "$@"
#
# Fonte retirada do site mini.net/tcl
# Comentários Mauricio Maciel
# Cria tela
grid [canvas .c -width 200 -height 200]
set halfpi 1.570796
set piover6 0.5235987
set twopi 6.283185
# Tamanho e formato do relógio
.c create oval 2 2 198 198 -fill white -outline black
for { set h 1 } { $h <= 12 } { incr h } {
set angle [expr { $halfpi - $piover6 * $h }]
set x [expr { 100 + 90 * cos($angle) }]
set y [expr { 100 - 90 * sin($angle) }]
.c create text $x $y -text $h -font {Helvetica -12}
}
proc hands {} {
catch { .c delete withtag hands }
# Calcular segundos desde meia-noite
set s [expr { [clock seconds] - [clock scan 00:00:00] }]
# Angulo do ponteiro dos segundos
set angle [expr { $s * $::twopi / 60. }]
set y [expr { 100 - 90 * cos($angle) }]
set x [expr { 100 + 90 * sin($angle) }]
.c create line 100 100 $x $y -width 1 -tags hands
# Ponteiro do minuto
set angle [expr { $s * $::twopi / 60. / 60. }]
set y [expr { 100 - 85 * cos($angle) }]
set x [expr { 100 + 85 * sin($angle) }]
.c create line 100 100 $x $y -width 3 -capstyle projecting -tags hands
# Ponteiro da Hora
set angle [expr { $s * $::twopi / 60. / 60. / 12. }]
set y [expr { 100 - 60 * cos($angle) }]
set x [expr { 100 + 60 * sin($angle) }]
.c create line 100 100 $x $y -width 7 -capstyle projecting -tags hands
after 1000 hands
}
hands
Script em Tcl para descompactar arquivos
Crivo de Eratóstenes Simples em Tcl (sem Tk)
Renomeando arquivos de forma padronizada
Cirurgia para acelerar o openSUSE em HD externo via USB
Void Server como Domain Control
Modo Simples de Baixar e Usar o bash-completion
Monitorando o Preço do Bitcoin ou sua Cripto Favorita em Tempo Real com um Widget Flutuante
Atualizar Linux Mint 22.2 para 22.3 beta
Jogar games da Battle.net no Linux com Faugus Launcher
Como fazer a Instalação de aplicativos para acesso remoto ao Linux
Conky, alerta de temperatura alta (6)
Instalação do cosmic no archlinux (0)
Formas seguras de instalar Debian Sid [RESOLVIDO] (14)









