Relógio analógico
Publicado por Mauricio 08/09/2003
[ Hits: 9.962 ]
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
LazyDocker – Interface de Usuário em Tempo Real para o Docker
Instalando COSMIC no Linux Mint
Turbinando o Linux Mint: o poder das Nemo Actions
Inteligência Artificial no desenvolvimento de software: quando começar a usar?
O widget do Plasma 6 Área de Notificação
[Resolvido] Algo deu errado ao abrir seu perfil
Quando vocês pararam de testar distros? (14)
Problema com som no laptop (3)
Não estou conseguindo fazer funcionar meu Postfix na versão 2.4 no Deb... (2)









