[Fedora-users-br] tcl/tk

Alberto Vieira Ferreira Monteiro albmont em centroin.com.br
Qua Set 26 00:40:45 UTC 2007


Alguém aqui usa tcl/tk? Puro ou através do python (tkimage) ou 
R (library(tcltk))?

Eu estou com um bug nojento, que não ocorre no Windows: quando
eu uso a função getOpenFile, não tem como mostrar informações
nos arquivos, como data/hora ou tamanho.

Como exemplo, segue código em R:

library(tcltk)
fileName <- tclvalue(tkgetOpenFile()) # Very simple, isn't it?
if (!nchar(fileName)) {
    tkmessageBox(message = "No file was selected!")
} else {
    tkmessageBox(message = paste("The file selected was", fileName))
}

Em python:

import sys, os
import Tkinter, tkFileDialog

root = Tkinter.Tk()

txt = Tkinter.Text(root)
txt.insert(Tkinter.END, 'Teste do tkinter')
txt.pack()

def openFile(event = None):
  arquivo_tk = tkFileDialog
  nome = arquivo_tk.askopenfilename(initialdir="/home")
  txt.insert(Tkinter.END, "\nArquivo escolhido: " + nome)

txt.focus_set()
root.after_idle(openFile)

# this is usually the last line pertaining to the Windows window.
root.mainloop()

Alberto Monteiro





Mais detalhes sobre a lista de discussão Fedora-users-br