Calculadora em Tcl/Tk
Publicado por Mauricio 06/03/2004
[ Hits: 8.034 ]
Homepage: http://www.mbmaciel.com
Uma calculadora simples feita em tcl/tk
wm title . Calculadora grid [entry .e -textvar e -just right] -columnspan 5 bind .e <Return> = set n 0 foreach row { {7 8 9 + -} {4 5 6 * /} {1 2 3 ( )} {C 0 . = } } { foreach key $row { switch -- $key { = {set cmd =} C {set cmd {set clear 1; set e ""}} default {set cmd "hit $key"} } lappend keys [button .[incr n] -text $key -command $cmd] } eval grid $keys -sticky we ;#-padx 1 -pady 1 set keys [list] } grid .$n -columnspan 2 ;# aumenta o tamanha do tecla (=) proc = {} { regsub { =.+} $::e "" ::e ;# limpa resultado if [catch {lappend ::e = [set ::res [expr 1.0*$::e]]}] { .e config -fg red } .e xview end set ::clear 1 } proc hit {key} { if $::clear { set ::e "" if ![regexp {[0-9().]} $key] {set ::e $::res} .e config -fg black .e icursor end set ::clear 0 } .e insert end $key } set clear 0 focus .e ;# permite entradas no teclado wm resizable . 0 0
Renomeando arquivos de forma padronizada
Script em Tcl para descompactar arquivos
Script em Tcl para descompactar arquivos
param - abre aplicativos com parâmetros no Blackbox e outros
Resolver problemas de Internet
Como compartilhar a tela do Ubuntu com uma Smart TV (LG, Samsung, etc.)
Descritores de Arquivos e Swappiness
Solução rápida para o problema do Network Manager conectar mas não navegar
Como instalar no Linux Jogos da Steam só para Windows
Instalando o Team Viewer no Debian Trixie - problema no Policykit
Sunshine e Moonlight Linux (0)
Menu configurações e mudar plano de fundo não funcionam (7)