Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #8608 > unrolled thread

treeviewcontrol in tkinter.ttk

Started byWolfgang Meiners <WolfgangMeiners01@web.de>
First post2011-06-30 19:08 +0200
Last post2011-06-30 23:20 -0700
Articles 2 — 2 participants

Back to article view | Back to comp.lang.python


Contents

  treeviewcontrol in tkinter.ttk Wolfgang Meiners <WolfgangMeiners01@web.de> - 2011-06-30 19:08 +0200
    Re: treeviewcontrol in tkinter.ttk Ned Deily <nad@acm.org> - 2011-06-30 23:20 -0700

#8608 — treeviewcontrol in tkinter.ttk

FromWolfgang Meiners <WolfgangMeiners01@web.de>
Date2011-06-30 19:08 +0200
Subjecttreeviewcontrol in tkinter.ttk
Message-ID<4e0cad83$0$6583$9b4e6d93@newsspool3.arcor-online.net>
Hi all,
when i type the following code under python3, version 3.2 using osx 10.6.8:

##############################################################
#! /usr/bin/env python3
# -*- coding: utf-8 -*-

from tkinter import *
from tkinter.ttk import *
from tkinter.font import Font

root = Tk()
tv = Treeview(root, columns=['ad1', 'ad2'])
tv.pack()
tv.heading('#0', text='tree label', anchor=E)
tv.column('#0', anchor=E)
tv.heading('ad1', text='additional info 1', anchor=E)
tv.column('ad1', anchor=E)
tv.heading('ad2', text='additional info 2', anchor=E)
tv.column('ad2', anchor=E)

nd = tv.insert('', 'end', text='left aligned', values=['right aligned',
'right aligned'])
tv.column('#0', width=Font().measure('left aligned'))

for l in ['#0', '#1', '#2']:
    print('column %s \nheading options: %s \ncolumn options %s' %
	 (l, tv.heading(l, option=None), tv.column(l, option=None)))

root.mainloop()
##############################################################

i get the following output:

column #0
heading options: {'tate': '', 'text': 'tree label', 'image': '',
'command': '', 'anchor': 'e'}
column options {'minwidth': 20, 'width': 200, 'id': '', 'anchor': 'e',
'stretch': 1}
column #1
heading options: {'tate': '', 'text': 'additional info 1', 'image': '',
'command': '', 'anchor': 'e'}
column options {'minwidth': 20, 'width': 200, 'id': 'ad1', 'anchor':
'e', 'stretch': 1}
column #2
heading options: {'tate': '', 'text': 'additional info 2', 'image': '',
'command': '', 'anchor': 'e'}
column options {'minwidth': 20, 'width': 200, 'id': 'ad2', 'anchor':
'e', 'stretch': 1}

showing that all elements should be right aligned (anchor:'e').
Nevertheless, all headings are centered, the tree label is left aligned
while the rest is right aligned. This is not what i would expect.

Additional, the column width of the tree label is to small, one
charakter is missing. Can someone explain to me, how to do this the
right way?

Thank you for any hints
Wolfgang

[toc] | [next] | [standalone]


#8623

FromNed Deily <nad@acm.org>
Date2011-06-30 23:20 -0700
Message-ID<mailman.534.1309501239.1164.python-list@python.org>
In reply to#8608
In article <4e0cad83$0$6583$9b4e6d93@newsspool3.arcor-online.net>,
 Wolfgang Meiners <WolfgangMeiners01@web.de> wrote:
> when i type the following code under python3, version 3.2 using osx 10.6.8:
[...]

You might want to ask your question on the Tkinter list and/or possibly 
the Tcl Mac list.

http://mail.python.org/mailman/listinfo/tkinter-discuss
https://lists.sourceforge.net/lists/listinfo/tcl-mac

-- 
 Ned Deily,
 nad@acm.org

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web