1. First Question : Scrollbar
A solution consist of creating a top-level ttk.Treeview object, and another tree for every column. The scrollbars activations are linked to the top-level tree view. It's a bit more cumbersome than having the three columns in the same tree object, but it works :
# Top level Treeview object
bot = ttk.Treeview( Tkinter.Tk() )
# Columns (treeview objects also)
columns = create_columns( bot)
################################
## Scrollbars
vsb = ttk.Scrollbar( bot,
orient="vertical",
command = bot.yview
)
hsb = ttk.Scrollbar( bot,
orient="horizontal",
command = bot.xview
)
## Link scrollbars activation to top-level object
bot.configure( yscrollcommand=vsb.set,
xscrollcommand=hsb.set)
## Link scrollbar also to every columns
map ( lambda col : col.configure( yscrollcommand=vsb.set,xscrollcommand=hsb.set), columns )
Second Question : The border/ridge
Use the style configuration object
ttk.Style().configure( '.', # every class of object
relief = 'flat', # flat ridge for separator
borderwidth = 0, # zero width for the border
)
However it will not work on Windows : it is a bug (or a feature :p ).
Windows completely ignores the -borderwidth
parameter. (more infos on the comp.lang.tcl
mailing list : http://coding.derkeiler.com/Archive/Tcl/comp.lang.tcl/2007-11/msg00923.html )
Third Question : the truncature
That's the easiest question : the parameter -values
expect an iterable
for to apply to each columns. Ex:
for (col, value) in zip( tree.columns(), values ) :
col.insert(value)
That's where the bug is : a string
is also an iterable
! (it is literally a list of char) so when you try to call insert
with the message "This is a message"
, ttk will apply "This"
to the first column, "is"
to the second, and so on ...
To enforce the fact that the message should be applied as a whole, just add a coma at the end : (idmensajeactual,)
This code works :
chat2.insert("", "end", iid=(idmensajeactual,) , values=mensaje, tags=(messageid))
Finally
I've uploaded my stub as a github gist. You can check it out here and tweak it to your needs : https://gist.github.com/lucasg/7643411
Output :