You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I don't understand, Tk treats literal TAB escape sequence inside strings, passed in an AbstractString[] to TreeView, but only when not surrounded by spaces on either side. I red in the documentation that this widget can also be used to make grids/tables, but there is no example. Is it trying to make a grid with the tab separated values? It's always the second word of tab separated words, from the last string in the array, the one that appears to be passed to tcl_eval (can't understand how) as an argument:
julia>using Tk
julia> w =Toplevel()
Tk widget of type Tk.Tk_Toplevel
julia> f =Frame(w)
Tk widget of type Tk.Tk_Frame
julia>Treeview(f, ["a\tb", "c\td"])
ERROR: Tk.TclError
Tk.TclError("unknown option \"b\"")
in tcl_eval at /home/richit/.julia/v0.4/Tk/src/tkwidget.jl:96in tcl_eval at /home/richit/.julia/v0.4/Tk/src/tkwidget.jl:90in tcl at /home/richit/.julia/v0.4/Tk/src/core.jl:48in set_items at /home/richit/.julia/v0.4/Tk/src/widgets.jl:472in Treeview at /home/richit/.julia/v0.4/Tk/src/widgets.jl:454in Treeview at /home/richit/.julia/v0.4/Tk/src/widgets.jl:460
julia>Treeview(f, ["a\t b", "c\td"])
ERROR: Tk.TclError("unknown option \"d\"")
in tcl_eval at /home/richit/.julia/v0.4/Tk/src/tkwidget.jl:96in tcl_eval at /home/richit/.julia/v0.4/Tk/src/tkwidget.jl:90in tcl at /home/richit/.julia/v0.4/Tk/src/core.jl:48in set_items at /home/richit/.julia/v0.4/Tk/src/widgets.jl:472in Treeview at /home/richit/.julia/v0.4/Tk/src/widgets.jl:454in Treeview at /home/richit/.julia/v0.4/Tk/src/widgets.jl:460
julia>Treeview(f, ["a\t b", "c\t d"])
Tk widget of type Tk.Tk_Treeview
julia>Treeview(f, ["a \tb", "c\td"])
ERROR: Tk.TclError("unknown option \"d\"")
in tcl_eval at /home/richit/.julia/v0.4/Tk/src/tkwidget.jl:96in tcl_eval at /home/richit/.julia/v0.4/Tk/src/tkwidget.jl:90in tcl at /home/richit/.julia/v0.4/Tk/src/core.jl:48in set_items at /home/richit/.julia/v0.4/Tk/src/widgets.jl:472in Treeview at /home/richit/.julia/v0.4/Tk/src/widgets.jl:454in Treeview at /home/richit/.julia/v0.4/Tk/src/widgets.jl:460
julia>Treeview(f, ["a \tb", "c \td"])
Tk widget of type Tk.Tk_Treeview
julia>Treeview(f, ["a b", "c d"])
Tk widget of type Tk.Tk_Treeview
julia>VERSIONv"0.4.5"
julia> Pkg.status("Tk")
- Tk 0.3.7+ master
My case was even more weird since it worked at first. I was just testing Tk and ODBC (total GUI noob here). I put it here in case it's useful.
I have an app like this:
#!/usr/bin/env juliausing ODBC, Tk, DataFrames
functionupdate_app(w)
info("Actualizando!")
datos =query("SELECT * FROM alertas;")
registros = AbstractString[]
for dato ineachrow(datos)
id = dato[:id]
ip = dato[:ip]
lugar = dato[:lugar]
fecha = dato[:fecha_hora]
latitud = dato[:latitud]
longitud = dato[:longitud]
atendido = dato[:atendido]
fecha_atendido = dato[:fecha_hora_atendido]
registro = [id, ip, lugar, fecha, latitud, longitud, atendido, fecha_atendido]
registro =join(registro, "\t") # Booom!!!push!(registros, registro)
endpop!(w.children)
f =Frame(w)
pack(f, expand =true, fill ="both")
f1 =Frame(f) # need internal frame for use with scrollbars
lb =Treeview(f1, reverse(registros))
scrollbars_add(f1, lb)
pack(f1, expand =true, fill ="both")
b =Button(f, "Ok")
pack(b)
bind(b, "command") do path
ip_addr =match(r"^.*?(\d+\.\d+\.\d+\.\d+)\s*.*$", get_value(lb)[1]).captures[1]
run(`firefox "http://$(ip_addr):9000"`)
endsleep(5)
forget(f)
update_app(w)
endfunctionc5_app()
w =Toplevel("Consola C5")
set_size(w, 500, 300)
tcl("pack", "propagate", w, false)
Frame(w)
update_app(w)
end
ODBC.connect("c5db")
c5_app()
[richit@alertas~]$ julia c5_app.jl
INFO: Actualizando!
ERROR: LoadError: Tk.TclError("unknown option \"Booom!!!\"")
in tcl_eval at /home/richit/.julia/v0.4/Tk/src/tkwidget.jl:96in tcl_eval at /home/richit/.julia/v0.4/Tk/src/tkwidget.jl:90in tcl at /home/richit/.julia/v0.4/Tk/src/core.jl:48in set_items at /home/richit/.julia/v0.4/Tk/src/widgets.jl:472in Treeview at /home/richit/.julia/v0.4/Tk/src/widgets.jl:454in update_app at /home/richit/c5_app.jl:29in c5_app at /home/richit/c5_app.jl:48in include at ./boot.jl:261in include_from_node1 at ./loading.jl:320in process_options at ./client.jl:280in _start at ./client.jl:378while loading /home/richit/c5_app.jl, in expression starting on line 52
So I finally understood that changing \t for spaces solves the issue, but why? And why only when I inserted a new record with sql? (I'll have to look the exact SQL code used by my friend who populated the database and adds records via clicks on a RaspberryPi button, still I really can't see why this matters), if I add more registers to the table, it only fails from now on with the last register, second word between tabs, ie: ["OK\tOK\tOK", "OK\tOK\tOK", "OK\tBooom!!!\tOK?"]
here ---------------------------------------------------------^
I seem to be good as long as I change the tabs for spaces, ie: registro = join(registro, "\t") for registro = join(registro, " ").
The text was updated successfully, but these errors were encountered:
Ismael-VC
changed the title
Tk.TclError "unknown option" tab escape secuence.
Tk.TclError "unknown option" tab escape sequence.
Apr 21, 2016
I don't understand, Tk treats literal TAB escape sequence inside strings, passed in an
AbstractString[]
toTreeView
, but only when not surrounded by spaces on either side. I red in the documentation that this widget can also be used to make grids/tables, but there is no example. Is it trying to make a grid with the tab separated values? It's always the second word of tab separated words, from the last string in the array, the one that appears to be passed totcl_eval
(can't understand how) as an argument:My case was even more weird since it worked at first. I was just testing Tk and ODBC (total GUI noob here). I put it here in case it's useful.
I have an app like this:
And the table looks like this:
It works!
But oddly if add a new register to the database, it breaks, and only the last entry is an error now!
Now it's broken:
So I finally understood that changing
\t
for spaces solves the issue, but why? And why only when I inserted a new record with sql? (I'll have to look the exact SQL code used by my friend who populated the database and adds records via clicks on a RaspberryPi button, still I really can't see why this matters), if I add more registers to the table, it only fails from now on with the last register, second word between tabs, ie:["OK\tOK\tOK", "OK\tOK\tOK", "OK\tBooom!!!\tOK?"]
here ---------------------------------------------------------^
I seem to be good as long as I change the tabs for spaces, ie:
registro = join(registro, "\t")
forregistro = join(registro, " ")
.The text was updated successfully, but these errors were encountered: